The simple application of JavaScript in Web pages

Source: Internet
Author: User

Core tips: 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.

JavaScript BASIC data structure

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:

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:

<ptml> <br/><pead> <br/><body> <br/><script Language = "JavaScript" > <br />document.write ("Welcome to Web Production Tutorial web!"); <br/>document.close (); <br/></Script> <br/></body> <br/></pead> <br/></ptml>

Test2.html

Call test2.html in the browser's window.

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 logo <Script>...</Script> can be put into <head> ... </Head> or <Body> ... </ Between Body> . Place the JavaScript identity between the head to load the home page and the rest of the code to make the code more powerful; You can place the JavaScript identity in the body <body>. </Body> to implement some parts of the dynamic creation of a document.

-->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.