JS Dom Operation (ii) Window.docunment object operation

Source: Internet
Author: User

Positioning of a pair of elements

In JS, you can use the ID, class, name, tag name for element positioning

ID, class is used in the client

Name is used on the service side

Locate with ID --only one can be found by ID

var a = document.getElementById ( "id name" )

--Change the found to the variable a

Use class to locate

var a = documen.getelementsbyclassname ( "class name")

--Find the array according to ClassName.

Positioning with Markers

var a = document.getElementsByTagName ("tag name")

--based on the tag name, find out the array

Use name to locate

var a = Document.getelementsbyname ( "name name" )

--Search by name, find out the array

Two mastery of three events

onclick --click events

onmouseover -mouse Move-in event

onmouseout --Mouse out event

Three styles of control marks

Tag object. style. style = "value";
Style "-" to delete, the first letter in the back becomes uppercase

On the right side of the equal sign, you can see the value of the inline style of the element.

JS, the object's Index property, you can record a value of type int

JS Dom Operation (ii) Window.docunment object operation

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.