JS Learning Note 2---HTML property operations

Source: Internet
Author: User

1.HTML Property Manipulation: Read, write

Property name

Property value

2. Property read operation: Get, find

A) Syntax: element. Property name

such as: document.getElementById ("BTN"). Value;

b) connection of strings: +

3. Property write Operation: ("Add") Replace, modify

A) Syntax: element. property name = new value

such as: document.getElementById ("BTN"). Value = "Well, Coax ~ change Change";

4 . Element content operations:("add") Replace, modify

op.innerhtml Read all HTML content within an element

op.innerhtml = new value Replace all HTML content within the element

5.a=a+b =====> a+=b

6. Read and write operation precautions:

Note Reserved words and keywords

a) reserved word: Class ...

b) Keywords: var, function,...

Precautions

A) do not judge all the relative paths!

b) Color values do not take to make judgments!

c) InnerHTML do not take it for judgment!

7. How to use the "[]":

ODiv.style.width = Obtn1.value; The following values cannot be changed.

Odiv.style[width] = Obtn1.value; [] The value inside can be changed

JS allows the " . " become " []", such as Obtn.onclick ===> obtn['onclick']

JS Learning Note 2---HTML property operations

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.