[Javascript] Problem adding childs to select box in another window.

Antony Paul antonypaul24 at hotmail.com
Thu Jan 22 00:48:56 CST 2004


Hi all,
    I am having problem adding an element to a select box in another window.
It is throwing an exception saying Runtime error occurred. This is what I am
trying to do. In one page open a new window using this code
function linkme(me){
    win = window.open("Noname2.html","f");
}

In second window(Noname2.html) it have a text box and a button. Clicking
button will add the contents of text box to parent windows select box. I
would like to get added in alphabetical order or at the top. This code is
adding this.
<script language="JavaScript1.2">
function saveme(me){  // me is form.
 var target = window.opener.document.forms[0].a;
 target.options[target.options.length] = new Option(me.val.value,
me.val.value , false,false);
}
</script>

But this throws exception at last line. I know it is some coding mistake.
Please help me correct this.

rgds
Antony Paul



More information about the Javascript mailing list