Rakafkaven
asked on
Copy existing dropdown menu from parent to pop-up: IE hates it
I figure out one thing with this pop-up, something else stops working. My main window spawns a pop-up calculator. This calculator needs to have a drop-down select box identical to one on the main page. I've tried two different methods that work brilliantly in Firefox and not at all in Internet Explorer. No dropdown appears at all in the pop-up, and Explorer says the server "threw an exception" on the line below:
selSubMetal.options[i] = new Option(selMainMetal.option s[i].text, selMainMetal.options[i].va lue);
I also tried using cloneNode prior to using the for loop: explorer behaved the same but the error then said "No such interface supported" on the "celMetSel.appendChild(sel SubMetal); " line. Firefox, again, worked without a hitch.
I added "alert (selMainMetal.length);" above the commented-out cloneNode attempt: selMainMetal is the variable representing the source select box, and the alert brings the correct value (19) in all attempts, which indicates that the source is coming in fine-- I just haven't figured out how to make the target inherit the options.
I'm starting to dislike Explorer. Site is up at http://69.76.23.91/qfull.php , click the "Convert" button to see behavior.
function mCCaddElem() {
var tblMCTable = winMetalCalc.document.getE lementById ('tblMCCal c');
if (tblMCTable) {
var intMCRow= tblMCTable.insertRow(0);
var celMetSelLbl = intMCRow.insertCell(0);
var lblMetSelLbl = winMetalCalc.document.crea teTextNode ('Metal Type');
celMetSelLbl.appendChild(l blMetSelLb l);
var celMetSel = intMCRow.insertCell(1);
var selMainMetal = winMetalCalc.opener.docume nt.getElem entById('s elPPMet');
alert (selMainMetal.length);
//var selSubMetal = selMainMetal.cloneNode(tru e); //firefox only
var selSubMetal = winMetalCalc.document.crea teElement( 'select');
for (i=0; i < selMainMetal.length; i++) {
selSubMetal.options[i] = new Option(selMainMetal.option s[i].text, selMainMetal.options[i].va lue);
}
selSubMetal.value = selMainMetal.value;
celMetSel.appendChild(selS ubMetal);
}
else tId= setTimeout('mCCaddElem()', 100);
}
selSubMetal.options[i] = new Option(selMainMetal.option
I also tried using cloneNode prior to using the for loop: explorer behaved the same but the error then said "No such interface supported" on the "celMetSel.appendChild(sel
I added "alert (selMainMetal.length);" above the commented-out cloneNode attempt: selMainMetal is the variable representing the source select box, and the alert brings the correct value (19) in all attempts, which indicates that the source is coming in fine-- I just haven't figured out how to make the target inherit the options.
I'm starting to dislike Explorer. Site is up at http://69.76.23.91/qfull.php , click the "Convert" button to see behavior.
function mCCaddElem() {
var tblMCTable = winMetalCalc.document.getE
if (tblMCTable) {
var intMCRow= tblMCTable.insertRow(0);
var celMetSelLbl = intMCRow.insertCell(0);
var lblMetSelLbl = winMetalCalc.document.crea
celMetSelLbl.appendChild(l
var celMetSel = intMCRow.insertCell(1);
var selMainMetal = winMetalCalc.opener.docume
alert (selMainMetal.length);
//var selSubMetal = selMainMetal.cloneNode(tru
var selSubMetal = winMetalCalc.document.crea
for (i=0; i < selMainMetal.length; i++) {
selSubMetal.options[i] = new Option(selMainMetal.option
}
selSubMetal.value = selMainMetal.value;
celMetSel.appendChild(selS
}
else tId= setTimeout('mCCaddElem()',
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!