About Obj.currentStyle.property, window.getComputedStyle (obj,null). Understanding of property and Obj.style.property

Source: Internet
Author: User

First, Obj,style.property.

I have been using this Obj.style.property property to modify the inline and outer obj properties, but from the Internet to see the Obj.style.property incredibly can only read the embedded style, can not read the external and inline style, I tried it, and sure enough, the example is to change the UL WI DTH properties, see the small partners can go to try, for the embedded property is read-write, but for inline and external properties is write-only, unreadable

Then there are the other two, these two are powerful, the reason is two, is to be compatible with IE

Obj.currentStyle.property is an isolated support of IE browser to get element attributes worth the method, can get the attribute value of the element of any location setting, including inline, inline, outer; that is, you can get all the properties, but you can't override the attributes. Read-only non-writable

window.getComputedStyle (Obj,null). Property is a relatively popular method, Google, Firefox, Opera,sarifi all support the method to get the attributes of the element, where the second parameter is pseudo-class, if you need to get not pseudo-class, You need to set this value to null;
Obj.style.property can only get the inline style property value of an element, and the other two can get the property value set in inline, inline, and inline.

About Obj.currentStyle.property, window.getComputedStyle (obj,null). Understanding of property and Obj.style.property

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.