Why is there a semicolon after the statement document.Write();? And window.alert() is not used?
Martin_Wu
Martin_Wu 2018-03-11 21:04:09
0
4
1491

<!DOCTYPE HTML>
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <title>php.cn</title>
 <script type="text/javascript">
 //在<body>中输出一句话
 document.write("欢迎来到php.cn");
 window.alert("Sorry,The paassword your input is uncorrect,Please try again!")
 </script>
 </head>
 <body>
 </body>
</html>

Martin_Wu
Martin_Wu

reply all(4)
郭骏博

You can omit the last line, but it is not recommended

寻觅 beyond

Characteristics of the JavaScript language:

There is no need to add a semicolon after each statement. This is the case when only one statement is written in one line;

If multiple statements are written in one line, each statement It is necessary to use a semicolon to separate;

But most languages ​​require a semicolon at the end. In order to get used to it

so, it is voluntary to add it or not, but it is recommended to add it

大辉狼

You don’t need to add

, just change the line

路过

You can add it or not

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template