Hi Robert
The following works in IE5 with no doctype. I hope it helps
Jimbo
html file to with list and button to open new window
<HTML><HEAD><TITLE>populate select opener</TITLE>
<script type=text/javascript>
var listOptions=new Array("Sat","Sun","Mon","Tues","Wed","Thurs","Fri" );
function changeList(index) {
// use index to decide how to populate list
// this example uses the listOptions array
var a=document.forms["whatever"].elements["openerList"];
for (var i=0;i<listOptions.length;i++)
a[i]=new Option(listOptions[i]);
}
function openNewWin() {
winRef=window.open("popselectwin2.htm");
}
</script></HEAD>
<BODY>
<form name="whatever">
<select name="openerList"><option>day1<option>day2</select>
<button onclick="openNewWin()">Open Window</button></form>
</BODY></HTML>
html for window that gets opened
<HTML><HEAD> <TITLE>populate select in opener</TITLE></HEAD>
<BODY>
<select
onchange=window.opener.changeList(this.selectedInd ex)><option>one<option>two
</select>
</BODY></HTML>
I hope this helps
"Robert Nurse" <rn****@cudbytech.net> wrote in message
news:a9*************************@posting.google.co m...
Hi All,
I'm trying to alter the contents of a drop-down (select) list on the
parent window from a child window in IE 6. After opening the child
window, I set its opener to reference the parent like this:
childwin = window.open(...)
if (childwin == null)
childwin.opener = self;
The above code is suspicious. if(childwin==null) the window wasn't opened
and your reference to childwin.opener and further assignment should at least
throw a fit if not an exception.
Then, to update the parent select list from the child window, I do
this:
opener.document.myForm.NameOfSelect.options.length = 0;
opener.document.myForm.NameOfSelect.options[0] = new Option("", "");
for (var ixy = 1; ixy <= newDataArray.length; ixy++)
{
opener.document.myForm.NameOfSelect.options[ixy] = new
Option(someNewDisplayText, newValue);
}
looks OK. maybe window.opener is safer
This looks correct and works up to a point. I can empty the parent
select by setting the its options.length to zero. But, when I try to
add new options, IE gives me a "server threw an exception" message.
Is all this even possible in IE?
TIA.