With the cross frame option, the following code will fail in IE5, but there are no problems in IE4, IE6, Opera6, Nnx:
<script>function addoption (Aselect, optionID, Optionname) { Aselect.options[aselect.options.length] = newoption;} </script>
This is the right thing to do:
<script>function addoption (Aselect, optionID, Optionname) { Ownerwindow = ASelect.document.parentWindow; Ownerwindow.newoption = new Option (optionname, optionID); Aselect.options[aselect.options.length] = ownerwindow.newoption;} function Crossframeaddoption () { var aselect = Parent.otherframename.document.forms[0].theselectname; AddOption (aselect, "id" + aSelect.options.length, "name" + aSelect.options.length);} </script><input type= "button" value= "Test" >
Microsoft's explanation is as follows: In general, at least in the older browser versions, performance seems to improve if your call methods on the target frame I F They are stored there as. This is particularly relevant when trying to add options to a select box in another frame. Make sure you create the "option in" and "I" are adding it to a local select box, instead of trying to cross Frame boundaries.
Http://msdn.microsoft.com/library/default.asp?url =/library/en-us/dnwebteam/html/webteam02052002.asp |