[thelist] Tip

Rory.Plaire at wahchang.com Rory.Plaire at wahchang.com
Thu Oct 11 22:21:52 CDT 2001


Feeling like I have been in control enough the past few weeks to not need to
put this in the tip jar, I am exercising magnanimity. 

I've always wanted to know how that feels.

Of course, I wonder if I'll need this in the near future... (Must....
stop... off-topic... thought.... NO!... [Ctrl-R] Blah blah blah... You get
the picture.)


<tip type="IE Cross Window Object Tennis">
Opening a window with JS and passing back values and the like to the opener
with JS?

In IE 5.x (but by God, this might be on Moz and NN6 too, since they now
sport a real DOM implementation), if you try to add an option to a select
element with the code:

var newOpt = document.createElement("OPTION");
newOpt.text = sSomeText;
newOpt.value = sSomeValue;
opener.document.forms[0].mySelect.options.add(newOpt);

... you bring down the browser hard.

Try:

var newOpt = opener.document.createElement("OPTION");
...
(as above)
...

One might expect the original code to not work, but then why does the
browser exit so, well, unexpectedly? Maybe its just MS and I who don't get
it. Hmmm... finally, we saw eye-to-eye on something!

Anyway, thought it was worth a tip. Enjoy! 8)

P.S. this is for an INTRANET application, so I can ignore cross-browser
issues -- for now. You might have guessed: this code ain't gonna cut it on
most types of browsers out there.
</tip>




More information about the thelist mailing list