1 1.1---JavaScript basic syntax (-)-Introduction, implementation, output:
Scripts in HTML must be located between <script></script> tags
Scripts can be placed in the <body> and
Write code between <script></script>
Usage Restrictions:
In HTML, do not limit the number of scripts (can use many pairs <script></script> tags)
Scripts are usually placed in the
Can create JS (in the JS file does not need to use the script tag) file, directly through the src= "JS filename" in the HTML file using the JS scripting language
Javascipt output:
Document output: document.write ("
You need to use "" and you can use labels directly in the output statement.
1.2---JavaScript basic syntax (-)-Syntax and annotations:
JS statements like a browser issue commands. The purpose of the statement is to tell the browser what to do.
Semicolon: The split between statements is a semicolon (;)
Note that semicolons are optional, and sometimes you see that they are not separated by semicolons. (for writing specifications, preferably with)
In addition, JS syntax and comments and C language almost the same as (case-sensitive), I am not redundant, just say the difference:
JS identifiers begin with a letter, underscore, or dollar sign .
JS will ignore the extra spaces. line breaks between code letters are not allowed.
Another thing to say:
JS executes sequentially in the written order, but if the following statements overwrite the previous statement, the preceding statement is equivalent to no writing.
That is, the preceding statement is overwritten directly.
such as: Doucument.getelementbyid ("pid"). Innerhtml= "HH";
Doucument.getelementbyid ("pid"). Innerhtml= "MM";
Last output mm only;
JavaScript (JS)