what does this <!-- // --> mean in javascript? a comment? if I have, <script src="One.js" language="Javascript"> <!-- // --> </script> <script src="Two.js" language="Javascript"> <!-- // --> </script> what does it mean actually? can't I directly write - <script src="/_commonjs/CommonJavaScript.js" language="Javascript"> </script> <script src="/_commonjs/GlobScreenIdentity.js" language="Javascript"> </script> Thanks and Regards, Tina
Alongwith being a good coder, try to be a good professional as well!
These were added because of two reasons 1. The old browsers which dont recognzie javascript scripts tag is ignored. then it will also skip code between the comments coz its basically html commment rt. 2. the second scenario is that some users can disable javascript. but that doesnt mean that browser wont excecute that. so in those case also those will be code is between the comments then the browser will skip the code.
Oh.. If it is ok that the javascript does not get executed due to some reasons, I enclose the function in the structure. Am I right? What is a common practice? It is always safer to enclose by JS functions likewise? Tina
Alongwith being a good coder, try to be a good professional as well!
Putting Java Script code in comments (<!-- --> is the common practice. This prevents browser from showing javascript code in case the user disables Java Script or in case of old browsers and Java Script errors.
Putting Java Script code in comments (<!-- --> is the common practice. This prevents browser from showing javascript code in case the user disables Java Script or in case of old browsers and Java Script errors.