Quote:
Originally Posted by milesdriven
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.