Step into javascript----a big wave js is approaching (i)

Source: Internet
Author: User
Tags html tags

javascript, who used to smell its name in the past, always wondered what the relationship was with java, the son of java? Grandson? Still is???

well, after studying, understand, is the wife cake and wife relationship (manual Funny).

Basic features of Javascript:
1. browser-based.
2. Based on (object-oriented) objects: flexible and convenient, but unable to create a complete project. So distance-oriented objects have a gap.
3. Event-driven.
4. Scripting Language: fast, does not need to compile, in the front-end can solve the Problem.

function Characteristics (of the four):
1. Verification of forms, reduce the pressure on the service side;
2. Add a page animation effect;
3. Dynamic change of page requirements;
4.ajax Network request: Asynchronous request can be done without jump refresh

Composition
Ecmascript+dom (document Object Model) +bom (browser Object Model)

external JavaScript files
Script referencing external JS do not use a single label
Do not write code in script that references external JS
The script that applies the external JS can be placed anywhere on the Page.

How JavaScript is Executed:
1. Browser input, parsing HTML tags and javascript scripts;
2. The client requests the page containing js;
3. Download the javascript-containing page from the server Side.

Primary-related instances:

string concatenation var num= ' ADF ';            var num2= ' 2 ';            Alert (num+num2) Alert (isNaN (num+num2))//isnan () Determines whether an object contains letters inside it, which is true, otherwise false (only pure numbers show false).            var num= ' adfasdf ' alert (number (num)) var num2=46556; Alert (number (num2)) var num3= ' 123456 ' alert (typeof (num3)) alert (typeof (alert (num3) ))//number converted is no type.//the parsefloat and parseint algorithm (JS algorithm is very flexible, but also very not rigorous, such as 100 can not be converted to 100.0)//that is, plastic            cannot be converted to floating-point type.            var num4= ' 100.4 ' alert (typeof (num4)); var num5=parsefloat (num4) var num6=parseint (num4) alert (num5) alert (num6) Aler T (typeof (num5)) alert (typeof (num6))//String: The difference between a single quotation mark or a double quote (single quote or double quote): var a = ' Hello ' var b= "hello"//actually no difference ..., but not "//object: a collection of different types of data, whose type is Object.            It's kind of like class classes in C + +. var d1=document.getelementbyid (d1) alert (typeof (d1)) var hanwen=new Object; hanwen.age=13 hanwen.name= ' Mahanwen ' hanwen.height=175 alert (typeof (HANWEN)) V            Ar a1;            var a2;            var a3;     A1=prompt (' name ', ' ') a2=prompt (' School Number ', ' ') a3=prompt (' age ', ' ') alert ("your name:" +a1+ "your study number:" +a2+ " Your age "+a3"

JavaScript operators:

A more flexible comparison, but not rigorous. Alert (a==b);//a More rigorous comparison method, not commonly used alert (a===b), var c;c=5/3;alert (c)//decimal, and not as a C + + as Rounding.

Self-increment operators and self-subtraction operations require attention:

Determine if the number of daffodils is:

//var n;//var num;//num=prompt (' Please enter the number you want to verify ')//var str=num.split (');//Alert (str)//n=str.length;//Alert (n)//var and=0;//for (var I=0;i<str.length;i++) {//And+=math.pow (str[i],n);//Alert (and)//            }//if (and==num) {//Alert (num+ ' is the number of daffodils ')//            }//judgment can be used: alert (num==and? ') The number is the number of daffodils ': ' The number is not a number of daffodils ')

Membership card number Lottery system:

//             var num=prompt (' Please enter the membership card number ')//            var str=num.split ('); //             var and=0; // for             (var i=0;i<str.length;i++) {//                and+= (parseint (str[i]))//              }//            alert (and>20? ') ' 0 ')

Step into javascript----a big wave js is approaching (i)

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.