| Author |
comment?
|
Tina Desai
Ranch Hand
Joined: Mar 13, 2003
Posts: 365
|
|
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!
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
<!-- Means if I am a browser that does not understand javascript then skip me. You really do not need it. -->
|
 |
sunitha reghu
Ranch Hand
Joined: Dec 12, 2002
Posts: 937
|
|
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.
|
 |
Tina Desai
Ranch Hand
Joined: Mar 13, 2003
Posts: 365
|
|
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
|
 |
Idly Vada
Ranch Hand
Joined: Sep 02, 2003
Posts: 135
|
|
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.
|
 |
Idly Vada
Ranch Hand
Joined: Sep 02, 2003
Posts: 135
|
|
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.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
It was a common practice. I don't see it much anymore. How many modern browsers don't support Javascript? bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: comment?
|
|
|