How select a selected option with "value" in IE

O

ouioui

Hi,

I try to have a communicatition between 2 windows

In the first one i have a HTML styled select like that :
<form name='addform' id='addform' action='add_dossier.php'
method='post' >
......
<select size='1' name='consultant_id' id='consultant_id'>
<option value='5'>Paul Poupo</option>
<option value='6'>Franck Schmith</option>
<option value='17'>Pascal Belci</option>
</select>
.....
</form>

In the second windows (opened by the first) i try to select a selected
option with his value.

This code :

self.opener.document.forms['addform'].consultant_id.value = 17;

is ok with mozzilla or firefox (Pascal Belci is well selected) but
don't work with IE (nothing append).

How can i selected an option with Internet explorer ?

Best regard
 
M

Michael Winter

[snip]
<form name='addform' id='addform' action='add_dossier.php'
method='post' >
.....
<select size='1' name='consultant_id' id='consultant_id'>
<option value='5'>Paul Poupo</option>
<option value='6'>Franck Schmith</option>
<option value='17'>Pascal Belci</option>
</select>
....
</form>
[snip]

self.opener.document.forms['addform'].consultant_id.value = 17;

[snip]

If you're trying to change the currently selected item, modify the
selectedIndex property. To select the third item, you'd use:

opener.document.forms['addform'].elements['consultant_id'
].selectedIndex = 2;

Hope that helps,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top