The browser does not support javascript JS script will display the page content

The browser does not support javascript JS script will display the page content. In order to prevent this from happening, you can use this HTML comment tags:
<HTML>
<body>
<Script of the type = "text / JavaScript">
<!
file. Write ( "Hello, world!"); //
->
</ Script>
<body>
</ HTML>
two forward slash comment line is a comment at the end of javascript symbol , it prevented the javascript compiler of the line .
Question
since it is a comment, why does it appear in the display results?
Questioning and answer
1. If the browser supports JS, JS then // is the comment, and <! - / -> not comment. So <! - / -> JS does not affect the execution of other statements.

2. If your browser does not support JS code, the browser will be treated as all the scripting language HTML. In this case, use the <! - / -> browser treats them as comments, instead of displaying JS content.

Guess you like

Origin www.cnblogs.com/blogst/p/10949850.html