DOM operations common property summarization _ javascript skills

Source: Internet
Author: User
This article mainly introduces some common attribute summary for DOM operations, which is quite comprehensive. the attached example is a very good article about how to improve DOM operations and I recommend it to you. 1. DOM:The Document Object Model DOM (DOM) defines the standard methods for accessing and processing HTML documents. DOM presents HTML documents as a tree (node tree) with elements, attributes, and text ).

2. some common attributes of DOM

2.1 obtain elements by ID

(1) syntax:

The code is as follows:


Document. getElementById ("id ");

(2) function: id refers to a person's id card. we can search for the tag id and perform corresponding operations.

(3) Note: Do not forget to write the document!

2.2 innerHTML attributes

(1) syntax:

The code is as follows:


Obgect. innerHTML = "Hello World"

(2) function: Obtains or replaces the content in the tag.

(3) example:

The code is as follows:






InnerHTML


Javascript

JavaScript is a simple scripting language based on objects and events. it is embedded in HTML documents and is interpreted and executed by the browser, create dynamic display effects on the web page and implement interaction with users.


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.