IE5 with JavaScript across frame plus option problem

Source: Internet
Author: User
Javascript| problem

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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.