Implement JavaScript to hide Script code

Source: Internet
Author: User

For JavaScript beginners, they often forget to hide JavaScript code in old browsers (such as Netscape Navigator 1.12. You may ask why to hide it? The reason is that the old browser does not support JavaScript. If you do not take the correct measures, your JavaScript source code will be displayed in the old browser, just like HTML, so you must hide JavaScript. Specifically, you can use some HTML statements to easily hide Javascript from the old browser.

The Code is as follows:


Browsers that support JavaScript will interpret this code, while the old browser will only regard it as HTML, and it has been commented out, so it achieves the purpose of hiding JavaScript code. You may want to add some text

In fact, there are very few browsers that do not support JavaScript. Even if there are, there are almost no people using that browser. This label can be ignored during normal production. But then again, it is very important for a programmer to cultivate good programming habits. Of course, it starts from a trivial matter.

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.