Google Browser is not compatible with some JS

Source: Internet
Author: User

This blog post main record I encountered in the actual application of the Google browser and some JS incompatible issues, over time, the content of this blog post may be more and more, may not be a bit (I think Google is certainly very good at the moment).

1. Google Chrome is not compatibledocument.getElementById ("Companyli"). style= "Display:block";

Using JS to change the display and hiding of page elements:

document.getElementById ("Companyli"). style= "Display:block";//Display

    document.getElementById ("Companyli"). style= "Display:none";//Hide

The above two lines of code Google, 360, IE11 incompatible, Firefox browser compatible.

document.getElementById ("Companyli"). style.display= "block";//Display

document.getElementById ("Companyli"). style.display= "None";//Hide

The above two lines of code are compatible with each large browser.

Of course you can also use jquery, that's a lot easier, you can use

$ ("#元素Id"). Hide ();//Hidden

$ ("#元素Id"). Show ();//Display

You can also use $ ("#元素Id"). Toggle (); To control the display and hiding of elements.

Thank you for your patience to read the whole post!!!
If there are any errors or improper articles, please treatise!
you have any comments or suggestions, you can send me an e-mail, you can also leave a message below, I saw the first time to reply to you, thank you!  

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.