JavaScript syntax for HTML browser compatibility

Source: Internet
Author: User

1. You can use the same JS variable name as the HTML node object ID attribute value in FireFox, but not in IE.

Workaround: Differentiate on naming HTML Node Object ID attribute value and JS variable

2. IE does not support JS Const, can not define JS constant

Workaround: All variables are defined with Var

3. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; js margin:0px; padding:0px; font-family: Arial "> address string & &< Span style= "margin:0px; padding:0px; Font-family: Song body ">" (), don't write" &amp; Url Abnormal errors are identified

4. in IE you can open mode and non-modal windowsvia ShowModalDialog and showModelessDialog, FireFox The next is not

Workaround: Use Window.Open method. If you need to pass parameters from a child window back to the parent window, you can use the Window.opener property in the Child window to access the parent window, and if you need a parent window to control the Subwindow, use Var subwindow = window.open (pageurl,name,parameters); to get the newly opened window object

&NBSP;

5. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; InsertRow () -1, table append 1 firefox Span style= "margin:0px; padding:0px; Font-family: The song Body "" parameter is empty will error

&NBSP;

6. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; in ie can be used in the" * " : 0px; padding:0px ">new ActiveXObject () var xmlDom = new ActiveXObject ("Microsoft.XMLHTTP"); but Firefox activexobject, var xmlDom = new XMLHttpRequest (); instantiating objects

JavaScript syntax for HTML browser compatibility

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.