The other way of ending a comment is to begin a JavaScript one-line comment-the kind that starts with // and ends with the end of the source line. Just make sure that the –> is at the end of the comment. As with the first method, browsers that don’t support JavaScript will close the comment that was begun after the <SCRIPT> tag when they see the –> at the end of the comment. Netscape sees it as a routine JavaScript comment.
And the only drawback to this technique is that it forces the </SCRIPT> tag to be on the next source line. If it were on the same line as the one-line comment, it would become part of the comment.
Leave a Reply
You must be logged in to post a comment.