Home > php教程 > php手册 > body text

JavaScript related knowledge

WBOY
Release: 2016-08-15 16:49:40
Original
1117 people have browsed it

JavaScript Grammar rules

l JavaScript is case sensitive

For example, variable a and variable A are different variables and must be strictly case-sensitive

l JavaScript scripts must be embedded in HTML files

Because the javascript script program is introduced through the script tag, the script tag must be written in the HTML document and cannot be written separately.

l JavaScript scripts cannot contain HTML markup code

Examples of incorrect writing:

window.document.write('php');

Correct writing:

var str;

str ='

';

str +='php';

str += '

';

window.document.write(str);

l Write one script statement per line

Easy for the browser to read, parse and execute each item one by one

l You can add a semicolon at the end of the statement. It must be the semicolon (;) in English. It is best to add a semicolon

l JavaScript script program can be saved independently as an external file

Advantages of externally imported js files:

1

, Separate structure, style, behavior (js) code

2. Conducive to program maintenance

3

, Higher security. Access can be prohibited by setting the permissions of the independent js file.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template