On the document.all attribute _javascript techniques under IE and Firefox

Source: Internet
Author: User
For example, the following code:
Copy Code code as follows:

<body>
<script language= "JavaScript" >
<!--
if (document.all)
Alert ("This is a IE");
Else
Alert ("This is a Mozilla");
-->
</SCRIPT>
</body>

In IE browser will output "This is a IE";
And in Firefox browser will output "This is a Mozilla."

But this is not directly to think in Firefox is not supported Document.all property methods.

The following section of code, in IE and Firefox browser are operating normally
Copy Code code as follows:

<body>
<input type= "text" id= "TXT" value= "ddd"/>
<script language= "JavaScript" >
<!--
var v = document.all.txt.value;
Alert (v);
-->
</SCRIPT>
</body>

This is because newer FF to all do a special treatment, JS in the process of the merchant bank detected only a separate all property is, will return jsval_void (that is, false) value;
When JS in the merchant bank process detected in the form of ' if (O.P) ... ' or ' (O.P)?...: ... ', return a htmlcollection to the image.
In Google Browser, there is a double division for all, both a collection and a JS VOID (false) value.

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.