Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up Window

Status
Not open for further replies.

sefafo

Programmer
Aug 28, 2003
36
CO
Hello!!!!

I am trying to do this.
A page has listbox with two options. Then I open a pop up window with another listbox with many options. What I want is to fill the firts listbox with the opction selected in the second list in the pop up window. I am doing like this..

Origen=document.frmsegundo.cmbCiudades;
Destino=opener.document.frmprueba.cbmultiple;
Destino.options[2]=new Option(Origen.options[0].text,Origen.options[0].value);

but I got this error:

The server throw an Exception.

Could you help me please!!! I will thank you a lot!!
 
Your code should work, at least in IE. You can try it a little different and see if it'll make any diffrence:

<script>
Origen=document.frmsegundo.cmbCiudades;
Destino=opener.document.frmprueba.cbmultiple;

var newOption = document.createElement(&quot;OPTION&quot;);
newOption.value = Origen.options[0].value;
newOption.text = Origen.options[0].text;

// to add a new option
//Destino.options.add(newOption);

// overwrite first option
Destino.options[2] = newOption;
</script>

 
Thanks a lot LV, It worked very good!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top