JavaScript, which provides scripting languages, is very similar to C + +, except that it removes easily-generated errors such as pointers in C and provides a powerful class library. For people who already have C + + or C, learning the JavaScript scripting language is a very relaxing thing to do.
One, the addition of JavaScript code
JavaScript scripts are included in HTML, which becomes part of the HTML document. Combined with the HTML logo, it forms a powerful Internet programming language. You can add JavaScript scripts directly to the document:
<Script Language ="JavaScript">
JavaScript语言代码;
JavaScript 语言代码;
....
</Script>
Description
By identifying <Script>...</Script> indicating JavaScript Script source code will be placed in the meantime.
by attribute language = "JavaScript" describes what language is used in the identity, and this is the JavaScript language, which represents the language used in JavaScript.
Here's an example of adding JavaScript script to a Web document:
Test2.html
<HTML>
<Head>
<Script Language ="JavaScript">
document. Write("这是赛迪网互动学校");
document. close();
</Script>
</Head>
</HTML>
Call test2.html in the browser's window, and the "This is Sadie Interactive School" string is displayed. See Figure 2 below.
Figure 2
Description
Document. Write () is the output function of the document object that prints the character or variable value in parentheses to the window; Close () closes the output.
The <Script>...</Script> logo can be put into head> ... </Head> or <Body> ...</body>. Place the JavaScript identity