Use JS to modify CSS style (1/4)

Source: Internet
Author: User

One, local change style
It is divided into two types: change the direct style, change the classname and change the CSS tutorial text three. It is to be noted that:
Note Case:
Web effects on the case is very sensitive, classname can not be "n" written "n", Csstext also can not write "T" written "T", otherwise can not achieve the effect.
Call Method:
If you change classname, the class is declared in the style sheet beforehand, but not with style, like document.getElementById (' obj '). Style.classname= "..." is wrong! Can only be written as: document.getElementById (' obj '). Classname= "..."
Change Csstext
But if you use Csstext, you must add style, the correct way is: document.getElementById (' obj '). style.csstext= "..."

Change the direct style I do not have to say, we remember to write to the specific style can be, such as
document.getElementById (' obj '). style.backgroundcolor= "#003366

Home 1 2 3 4 last page

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.