View Single Post
Old 05-31-2012, 08:14 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by milesdriven View Post
Also, I used the <!-- and //--> tags to prevent the javascript from displaying on the browser. It did anyway. Does anyone know why?
That's an HTML comment not a JavaScript one - people used to use it back in the 1990s to prevent the script displaying as content in IE2 and Netscape 1 and earlier browsers that didn't understand JavaScript. Once Netscape 1 use died out using that became unnecessary. JavaScript was specifically designed to ignore those tags so that they could be used to hide the script from displaying in the page in those browsers that didn't understand JavaScript.

The only use such a wrapper serves today is with some CMS where using it will result in the entire script being discarded and in XHTML where it converts the script into a comment.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote