Can't seem to create an object. 
Author Message
 Can't seem to create an object.

I'm trying to create and pass around an object which will contain the
names and handles of all windows (main and pop-up) which are active.
Part of the code to use this hasn't been written yet, but what I have is
working on NetScape, but giving me errors in IE.  Can anyone tell me
what I'm doing wrong?

Here is the code (text excises) from the initial page:

<script><!--

self.window.name = "Main";
var WindowList = {"Main":self};

        //-->

In subsequent pages the following is used to load a .js file:

</script><!--

<SCRIPT SRC="showi.js">
        </SCRIPT>

        //-->

which contains:

var BitsAcross = screen.width - 20;
var BitsDown = screen.height - 60;
if (typeof(WindowList) != 'undefined')
                {var WindowList = parent.WindowList}

function showimage(filename, windowname, x, y)
        {var Scroll = 0;
         if (x > BitsAcross)
                {var Scroll = 1;
                 x = BitsAcross};
         if (y > BitsDown)
                {var Scroll = 1;
                 y = BitsDown};
         var options =
"toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars="
                 + Scroll + ",width=" + x + ",height=" + y +
",screenX=0,screenY=0,left=0,top=0";
         var n = navigator.appName;
         if (n == "Netscape")
                {WindowList[windowname]=window.open(filename, windowname, options)}
           else {var WindowToUse = WindowList[windowname];
                 if (typeof(WindowToUse) != 'undefined' && !WindowToUse.closed)
                        {WindowToUse.resizeTo(x, y)};
                 WindowList[windowname]=window.open(filename, windowname, options)}

Quote:
}

The "if" on WindowList is to keep from trying to get to the parent of a
"Main" window.  When the showimage function is called I am told that
WindowList is not defined.

What am I missing here?  It seems straight forward, even if I seem to
need the resizeTo in IE, when it isn't required in Netscape.

Cyril N. Alberga



Mon, 10 Feb 2003 03:00:00 GMT  
 Can't seem to create an object.

This is a restatement of the problem, after I got over a number of
misunderstandings about the scope and persistance of variables in
JScript/JavaScript, as well as the meaning of the parent property
(wrong! I needed caller -- I think --).

I'm trying to maintain a list of the names (in the sense of tragets) of
all extant windows, associated with the handles of the windows.  The
reason is probably irrelivant, but if it would help I can expand this --
just SOMEBODY give me at least a hint.

Note that this is for an off-line presentation, coded in HTML and JS,
for (I had hoped) usablility on various platforms.

My current code is:

In the initial page:

<script><!--

self.window.name = "Main";
self.window.WindowList = {Main:self}

        //-->

in a .js file which is loaded by all other pages, including various
pop-ups:

var BitsAcross = screen.width - 20;
var BitsDown = screen.height - 60;
if (self.window.opener !== null)
                {self.window.WindowList = opener.window.WindowList}

function showimage(filename, windowname, x, y)
        {var Scroll = 0;
         if (x > BitsAcross)
                {var Scroll = 1;
                 x = BitsAcross};
         if (y > BitsDown)
                {var Scroll = 1;
                 y = BitsDown};
         var options =
"toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars="
                 + Scroll + ",width=" + x + ",height=" + y +
"screenX=0,screenY=0,left=0,top=0";
         var n = navigator.appName;
         if (n == "Netscape")
                {self.window.WindowList[windowname]=window.open(filename, windowname,
options)}
           else {var WindowToUse = self.window.WindowList[windowname];
                 if (typeof(WindowToUse) != 'undefined' && !WindowToUse.closed)
                        {WindowToUse.resizeTo(x, y)};
                 self.window.WindowList[windowname]=window.open(filename, windowname,
options)}

Quote:
}

I am currently debugging (trying to, at least) in Netscape, mainly
because I haven't found the I.E. equivalent to the Netscape de{*filter*}'s
inspector (can anyone point me to that?).

I have found that, even though the property WindowList gets initialized
in the home page that once I link (by a HTML link, not by the open
method) to another page it seems to vanish, eventhough it is still the
same window.

So, isn't there SOME place where I can hold onto a truly global value?

Cyril N. Alberga



Tue, 11 Feb 2003 03:00:00 GMT  
 Can't seem to create an object.



Quote:
> I am currently debugging (trying to, at least) in Netscape, mainly
> because I haven't found the I.E. equivalent to the Netscape de{*filter*}'s
> inspector (can anyone point me to that?).

Hi,

Take a look at http://www.*-*-*.com/ {*filter*}/

Quote:
> I have found that, even though the property WindowList gets initialized
> in the home page that once I link (by a HTML link, not by the open
> method) to another page it seems to vanish, eventhough it is still the
> same window.

This is because once you navigate away from a page, its object model goes
away with it. Any data you stash in the 'window' object is bound to a
specific page, rather than to an instance of Internet Explorer. To do
otherwise would almost certainly present a security problem.

Peter

--
Peter J. Torr - Microsoft Windows Script Program Manager

Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!



Tue, 11 Feb 2003 03:00:00 GMT  
 Can't seem to create an object.

Quote:



> > I am currently debugging (trying to, at least) in Netscape, mainly
> > because I haven't found the I.E. equivalent to the Netscape de{*filter*}'s
> > inspector (can anyone point me to that?).

> Hi,

> Take a look at http://www.*-*-*.com/ {*filter*}/

> > I have found that, even though the property WindowList gets initialized
> > in the home page that once I link (by a HTML link, not by the open
> > method) to another page it seems to vanish, eventhough it is still the
> > same window.

> This is because once you navigate away from a page, its object model goes
> away with it. Any data you stash in the 'window' object is bound to a
> specific page, rather than to an instance of Internet Explorer. To do
> otherwise would almost certainly present a security problem.

> Peter

OK, but then how CAN I check to see if a pop-up I want to use is open or
not?  The problem is that for some reason the simple "open" method which
works in NN doesn't resize the pop-up window if it is already open with
another image.  I had code which did a dummy open, then a close, and
finally the real open, but this looked awful, the dummy flashed a blank
window which then was replaced by the correct one.  I put a warning in
my introductory material (this is all for an off-line presentation which
I had hoped people could view with whatever browser they had) that IE
gave bad results, but I wanted to be able to drop the warning.

So -- should I just put up a big sign saying LOOKS BEST IN NETSCAPE?

I don't understand this language, I'm afraid.  I've tried leaving a
single root window holding the object, but I haven't figured out how to
access and update it from the children windows.  I have tried passing
the object around, hoping that it could be shared, but that doesn't seem
to work either.  I guess I'm spoiled by having been a LISP programer.

HELP!!!!!

Cyril



Tue, 11 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 'ActiveX can't create object'

2. Run-time error '429': ActiveX component can't create object

3. 'ActiveX can't create object'

4. 'ActiveX can't create object'

5. create object 'agent'

6. can't create object 'ADsSecurity"

7. define a measurement doesn't seem to work

8. location.replace doesn't seem to work

9. Can't seem to make server-side VBScript work

10. comparisons between decimal and hex values doesn't seem to work

11. response.expires doesn't seem to work!

12. My Script...Doesn't Seem to Work

 

 
Powered by phpBB® Forum Software