Why do we place JavaScript code inside comment fields?

  • Browsers that do not support JavaScript, will display JavaScript as page content.
  • To prevent them from doing this, and as a part of the JavaScript standard, the HTML comment tag should be used to "hide" the JavaScript.
  • Just add an HTML comment tag &lt!-- before the first JavaScript statement, and a --> (end of comment) after the last JavaScript statement.
  • However, this is an optional, but considered good practice.

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger