Jump to content

Are these needed?


Videogamer555

Recommended Posts

Often times I see a block of JS code like this:

<script type="text/javascript"><!--some JS codegoes here//--></script>

Since it already has the script tags to define the starting and stoping places of the JS code, are the <!-- and the //--> tags really neccesary? Why doesn't it just get written like this?:

<script type="text/javascript">some JS codegoes here</script>

On another note, do the <script> tags always have to be in the <head> section of the HTML document? Or can they also be in the <body> section? Or are they used in different sections based on specific needs of how specific parts of teh JS code it will be "activated"?

Link to comment
Share on other sites

That's just the way someone is directing you to put your code there. Here's the link for js comments http://www.w3schools...js_comments.asp js can go in the head or the body or can be external. http://www.w3schools.com/js/js_whereto.asp

Edited by niche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...