|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
dynamic select problem on IE
I'm having a problem populating a select list in an iframe by calling a function on the parent. I'm making the call from body onload of the iframe.
This works fine on Mozilla, and the code works fine if the select is placed on the parent form and called from there. Looking at the code in the debugger the select object appears to be fine, but IE complains 'Object doesn't support this property or method' when the select is on the iframe. Here's how I'm inserting the new element; function AddToOptionList(OptionList, OptionValue, OptionText) { // Add option to the bottom of the list OptionList.options[OptionList.length] = new Option(OptionText, OptionValue); |
|
#2
|
||||
|
||||
|
What value are you assigning "OptionList", the first function parameter?
|
|
#3
|
|||
|
|||
|
I pass the result of document.getElementById('selectListID') back to the function on the parent.
The object appears to be correct when inspected in the debugger, and works when called from within the parent frame, but IE gags when I pass this from the iframe. |
|
#4
|
||||
|
||||
|
document. refers to the current document. Therefore, I wouldn't think you would be able to refer to an object in an Iframe using only document.getElement(), because an iframe is usually treated as a unique frame (document). Instead refer to the iframe using the correct DOM.
Code:
parent.frames.yourIframeName.document.getElementBy Id("foo")
Note also that IE5 iframes must have a name tag (ID alone won't work). NS6/Moz must have an ID tag. So, use both, with the same value. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > dynamic select problem on IE |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|