JS Dom Learning Note two

Source: Internet
Author: User

Confessions of the Author:

   Know a general principle and meaning, this can reduce the actual operation of the error, the use, can be more handy.

1. Identify the object. (Know who you want to work with)

HTML to the Web page control, CSS to the style of the Web page, JS to provide Dynamic Web page effect, specifically the user's interaction (event), when the user through the input device to give the browser an event information, the browser to respond to the user. How the browser back to the user, the browser HTML file, so JS is the object of the HTML control and HTML elements of the style. objects need to correspond to the needs, it is easier to achieve the effect, more easily come up with the steps to achieve. (You cannot manipulate the object with a method that is not the object, clear the system of the entire api/library)

Example: Var a=13;//an object of type number

var obj={"name": "Marya", "Age": "18",}//an object of type objects

var str= "hello,my friend";//an object of type string

var Obj1=document.getelementbyid ("div");//An HTML Document node object

2 Use the object. (Smooth operation of the object, so that the object to complete the mission)

After the successful acquisition of the Document object by JS scripting language, it is necessary to use the code block that JS can understand and execute to get the object to complete its mission.

Example: Var a=0,b=3,c;//defining an object, let's manipulate the object with the variable name

c=a+b;//manipulating objects

var Obj1=document.getelementbyid ("div");//Get it and put it in obj1.

Console.log (Obj1.nodename); View Obj1 's NodeName properties (real business implementations, with more complex operations)

     

      

JS Dom Learning Note two

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.