devxlogo

The ‘greater-than’ vs. ‘comment’ dilemna

The ‘greater-than’ vs. ‘comment’ dilemna

Question:
The ‘greater-than’ vs. ‘comment’ dilemna

Answer:
There is a trick in writing JavaScripts which all developers should learn as soon as possible. When putting a script in your HTML, you should comment out the code (using ). The comments will keep the code from actually being written on the web page, yet won’t stop the parser from loading the script. Here’s a peek at what this looks like:

1. <hmtl>2. <title>A comment test</title>3. <SCRIPT LANGUAGE="JavaScript">4. <!-- This will hide the script from being displayed5. . . .6. // -->7. </SCRIPT>8. 9. . . . </hmtl>

devx-admin

Share the Post: