First knowledge of javascript!

Source: Internet
Author: User

A JavaScript is a nested scripting language! is a weakly typed language, and its interpreter is called the JavaScript engine and is part of the browser! The first is put in HTML to the Web page dynamic function of the whole page!

JavaScript is a client-side scripting language.

JavaScript is usually embedded directly into an HTML page.

JavaScript is an explanatory language.

The JavaScript language contains three core ECMAScript, DOM, and BOM.

Two JavaScript features!

"Client-side scripting language

"Client is synchronized to the server side, local services for customers in the program (such as QQ, you can enter the account in the local, password can access your server data like friends, chat records, etc.), generally installed on the ordinary client, need to work with the service side of each other. The other party that receives the service we call the client. JavaScript can be done locally to complete some of the most basic authentication (such as belonging to the mailbox, you can detect the mailbox format is not correct, you can directly remind users to enter the correct format) to reduce the burden on the server!

"Weak type language

Weak type language, also known as weak type definition language, is the opposite of strongly typed definitions (PS: Weakly typed languages are less stringent for input specifications, such as ";" at the end of the last sentence). Do not write, will not affect how the code to run, but in the final compression may cause unnecessary trouble, so the proposal or the place to write or to add! )!

So weak type language is sometimes very convenient, and sometimes very error-prone!

The use of weakly typed languages also pay careful attention to data types to prevent errors!

Limitations of three JavaScript

"There are many browsers on the internet, mainstream browsers such as Firefox, Internet explorer,opera,chrome,360, etc., but the degree of JavaScript supported by various browsers is different, So each browser running JavaScript effect will have a certain gap, and sometimes even no effect show!

JavaScript can't open , read, and save files on a user's computer!

Four-JavaScript annotation method

What do we do when we are writing or debugging JavaScript and we need them to be read out of the browser for the time being?

This time we usually use the annotation method, the browser is to read the parsing code from top to bottom, and when the browser reads the comment symbol, it will skip the reading!

The symbols of the annotations are divided into two kinds;

The single-line comment symbol is ' // What you want to annotate ... ' Enter two diagonal lines in front of the content you want to annotate, and you can comment on what you want to enter later, but this symbol will only take effect in the current line, and the next line will be the normal input.

Multiline comment '/* The content you want to annotate ... */' in the content you want to comment before and after the input '/ * * /' These four symbol combinations can be commented out in the middle of everything you enter if only input '/* ' and not the back of ' * *' as the end The following will all be commented out, note the integrity of this set of symbols!

Three ways to quote five JavaScript

1. Inline type:

  <script>

Fill in the language of JavaScript ....

</script>

This is also the most common, in the HTML directly written to the script tag (note is a double-closed tag ), the language of the JavaScript written inside.

2. Inline type:

<button onclick = ' JavaScript language ' ></button>

  <button onclick = ' function () '></button> //Click Invoke function with Name, OnClick is a click event in JavaScript

  <a href= "Javascript:alert (' AA '); alert (' BB ')"> click </a> //Click the a tag browser will pop up ' AA ', with ' BB ' 's prompt window;

In fact, it is not recommended to write JavaScript in this way, which will have some unnecessary effect on the stability of HTML overall!

3. Outreach:

  <script src= ' Your external JS file path '></script>  

Like CSS, we can create a suffix named ' js ' in the external file, we can write all of our JS content, through the above tag to import it into the HTML! This is also the most commonly used! PS: Usually said content, style, action, separate is this CSS and JS with external files written into the HTML! This way, you have to have a simple code, a sequence!

  

First knowledge of javascript!

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.