JavaScript's Preliminary

Source: Internet
Author: User

1. Introduction

 

HTML: Responsible for the structure of a page.

CSS: Responsible for the style of a page.

JavaScript: Responsible for interacting with the user.

The 1997 European Computer Protocol (ECMA) was organized to provide a protocol for JavaScript.
1. ECMASCIRPT (the basic syntax is standardized)
2. BOM (Browser object model)
3. DOM (Document Object model)

Features of javascript:
1. Cross-platform
2. Security. (JavaScript code does not directly access the contents of the hard drive)

The difference between JavaScript and Java:
1. JavaScript is a product of Netscape, and Java is the product of Sun Corporation.
2. JavaScript is an object-based language, and Java is an object-oriented language.
3. JavaScript is an interpreted language, and Java is an interpreted, compiled language.
4. JavaScript is a weakly typed language, and Java is a strongly typed language.

When declaring a variable in Java, you must specify the data type of the variable.
JavaScript declares that variables do not need to be explicitly what type of data, and any variable is declared with a keyword var .

2. Introduction method

 

How to write code for JavaScript.

Mode 1: Can be written using the <script> tag body.

Format:
<script type= "Text/javascript" >
JS Code;
</script>

Mode 2: Introduce an external JavaScript file.

Format:
<script src= "1.js" type= "Text/javascript" ></script>

Attention:
1.<script> is a start tag and end tag, do not end in a tag.
2. If <script> has been used to introduce the JS file, then the <script> tag body can no longer write JS code,

Common JavaScript functions:

Alert ("Show content:"); Pop-up box

document.write ("Data"); Output data to page ...


3, the page comments:

Content of HTML <!--annotations

Comments for CSS/* contents of comments */

JavaScript: The contents of the//comment single-line comment/* contents of the comment */Multiline comment

JavaScript's Preliminary

Related Article

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.