[Javascript] Mozilla valid javascript not working in IE
Luciano Ruete
luciano at lugmen.org.ar
Mon Sep 6 22:22:35 CDT 2004
Luciano Ruete escribiste :
> The code is simple, a parent opens a popup on demand, and the popup
> child reads a textbox, and add a option with the typed text in the
> parent's select object.
> This code works ok in Mozilla and Firefox, but when i tested in Internet
> Explorer and Opera does not.
>
> parent.html:
>
> myPopup = '';
> function openPopup(url) {
> myPopup = window.open(url,'popupWindow','width=640,height=480');
> if (!myPopup.opener)
> myPopup.opener = window;//also tested with self and this
> }
>
>
> son.html:
>
> var i = opener.document.forms[0].comboXXX.length;
> myNewOption = new Option("nevo item" ,23, true);
> opener.document.forms[0].comboXXX.options[i] = myNewOption;
> window.close();
>
>
> The code is generated whit php, here the php variables are hardcoded to
> simplify the script, also the function calls and the php if's.
>
> I discovery that forms[0] and options[i], must be forms[1] and
> options[i+1] in Opera (i do not have IE to test, sorry linux fan :-).
> But even with those changes, the parents select gets a new option, but
> whit no value, ie a blank select element. And the new option is not
> selected by default. Later test it in IE(a friend house) and same
> result: a new select blank option in the parent.
> I test a hardcoded.html version like i send in this post, no php involved.
i does not discover anything!, forget this paragraph, if i use a
options[i+1], i steel could not put a new object in the father's select,
but the index grows in 2 units, so the first shows as a blank option.
The second never shows because IE restriction(not allow option add from
other window). So index are the same in IE and Mozilla.
--
Luciano
More information about the Javascript
mailing list