JavaScript "accidentally called method or attribute access" in IE"

Source: Internet
Author: User

For the same piece of code, two calls, one pass, and one exception:
Function clearSelect (obj ){
If (obj & obj. options)
Obj. options. length = 0;
}
The following are some previous experiences:
These are two classic exceptions, which are difficult to locate if you do not know the principles. The following code shows the conditions that occur.
<Iframe src = "javascript: '<script> top. ff1 = {abc: function () {}}< \/script> '"width = 0 height = 0 name =" f1 "> </iframe>
<Button onclick = "f1.location = 'about: blank '; setTimeout ('alert (ff1.abc ()', 0)"> release Code cannot be executed. </button>
<Iframe src = "Javascript: '<script> top. ff2 = {abc: function () {}}< \/script> '"width = 0 height = 0 name =" f2 "> </iframe>
<Button onclick = "f2.location = 'about: blank '; setTimeout ('alert (ff2.toString ()', 0)"> accidentally called method or attribute access </button>
The innerHtml of the p tag cannot insert the center Tag:
<P onclick = "innerHTML = '<CENTER> </CENTER>'"> <button> unknown runtime error </button> </p>
The following is a classic "unable to open the Internet site" exception:
<Div id = "tt"> <div> <script> document. getElementById ("tt"). innerHTML = "" </script> </div>
From these examples, we can see that there is still much room for improvement in IE robustness.

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.