JavaScript "accidentally invokes method or property access" in IE _javascript tips
Source: Internet
Author: User
Same piece of code, two calls, one pass, one exception:
function Clearselect (obj) {
if (obj && obj.options)
obj.options.length=0;
}
Here are some of the previous experiences:
This is two classical anomalies, it is difficult to locate the principle. You can see the conditions that occur from the following code
<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) ' > cannot execute code that has been freed </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 a method or property access </ Button>
The innerHTML of the P tag cannot be inserted into the center tag:
<p onclick= "innerhtml= ' <CENTER></CENTER>" ><button> unknown run-time error </button></p>
The following is a classic "Unable to open Internet site" Exception:
<div id= "tt" ><div><script>document.getelementbyid ("tt"). Innerhtml= "" </script></div ></div>
From these examples you can see the robustness of IE there is a lot of room for improvement.
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