• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

comment?

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<!--
Means if I am a browser that does not understand javascript then skip me.
You really do not need it.
-->
 
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67651
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was a common practice. I don't see it much anymore. How many modern browsers don't support Javascript?
bear
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic