11-28 Web Base--javascript (DOM)

Source: Internet
Author: User
Tags tag name

Web Foundation Part II--htmldom operation

Definition: Htmldom is a model of an object-oriented tree that contains all the elements in the HTML, and all elements contained in the DOM can be found through HTML.

Second, the role:

1. Find HTML elements

1) Find elements by ID (document.getElementById ();)

<div id= "D" ></div>

var X=document.getelementbyid ("D");

2) Find elements by tag name

<div id= "M" ></div>

var X=document.getelementbyid ("M");

var y=x.getelementbytagname ("div");

3) Find elements by class name

Third, change the HTML

1) Change HTML content

2) changing HTML properties

3) Change HTML style

Iv. Htmldom Events

1) Reacting to events

2) HTML Event Properties

3) Use Htmldom to assign events

11-28 Web Base--javascript (DOM)

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.