JS (quad) DOM model attribute style

Source: Internet
Author: User

first, the DOM model

1. Introduction

DOM Model: Document Object model.

When the DOM is created: when the page is loaded, the browser creates the Document object model of the page.

1. Use

Through the DOM model, users can modify HTML element attributes and styles, add or subtract HTML elements, and respond to HTML element events.

second, commonly used JS dom function

1. Output stream: document.write (), dynamically create page output content.

2. Change the label content: document.getElementById ("id"). innerhtml= "";

3. Change the attribute: document.getElementById ("id"). src|href|title|..| ="";

4. Change the CSS style: document.getElementById ("id"). style.width|height|color|backgoundcolor= "";

5. Common Events

1) Click event: OnClick ()

2) Page Load event: onload () and onunload ()

3) Content Changes event: Change ()

4) Spotlight Event: onfocus ()

5) Mouse events: onmouseover (), onmouseout (), onmousedown (), onmouseup ()

6) Other events: ...

In fact, there are a lot of such events, you can refer to the JS DOM event table, which is a common part of the event.


Iii. Modifying properties and styling examples














JS (quad) DOM model attribute style

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.