Gets the truth of the element, and the final function of the CSS style attribute value.

Source: Internet
Author: User
// Obtain the style attribute (name) function getstyle (ELEM, name) of the specified Element (ELEM) {// If the attribute exists with style, so he has been set (and is the current) if (ELEM. style (name) return ELEM. style [name]; // otherwise, try to use the IE Method else if (ELEM. currentstyle) return ELEM. currentstyle [name]; // or W3C method. If so, else if (document. defaultview & document. defaultview. getcomputedstyle) {// It uses general "text-align" style rules instead of 'textign 'name = Name. replace (/([A-Z])/g, "-$1"); name = Name. tolowercase (); // get the style object and obtain the value var S = document if the property (exists. defaultview. getcomputedstyle (ELEM, ""); Return S & getpropervalue (name) ;}// otherwise, the user uses another browser elsereturn NULL;
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.