css--Creating CSS

Source: Internet
Author: User

Createinlinestyle:function() {//Create an inline style sheet            varstyle = document.createelement (' style ');//Create a STYLE element            varHead = Document.head | | document.getElementsByTagName (' head ') [0];//elementStyle.type = ' text/css ';//You must display the Type property of the style element as TEXT/CSS, otherwise it will not work in IEHead.appendchild (style);//Insert the created style element into the head            returnstyle; }, Getinlinestyle:function() {//get an inline style sheet; search backwards            varHead = Document.head | | document.getElementsByTagName (' head ') [0];//element            varchildren=Head.children; varInlinestyle =NULL;  for(vari = children.length-1; I >= 0; i--) {                varnode =Children[i]; if(Node.tagname = = "STYLE" && node.type = = "Text/css") {Inlinestyle=node;  Break; }            }            if(!inlinestyle) {//There is no inline style sheet createdInlinestyle = This.            Createinlinestyle (); }            returnInlinestyle; }, Addinlinecss:function(csstext) {varstyle = This.            Getinlinestyle (); if(Style.stylesheet) {//IE                varFunc =function () {                    Try{//prevents errors in IE from exceeding the limit of stylesheetStyle.styleSheet.cssText =Csstext; } Catch(e) {Console.log ("The number of stylesheet exceeds the limit!" "); }                }                //If the current stylesheet is not available, then the line is placed in async                if(style.styleSheet.disabled) {setTimeout (func,10); } Else{func (); }            } Else{// the                //In the Web browser, just create a text node and insert it into the style element.                varTextnode =document.createTextNode (csstext);            Style.appendchild (Textnode); }        }

Use:

var cssrowaltbackcolor = cssselect + "tr.datagrid-row-alt{background-color:" + Customstyle.rowaltbackcolor + "}";
Eai Addinlinecss (Cssrowaltbackcolor);

css--Creating CSS

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.