Friday, 22 June 2012

Find css Class using JavaScript


Find css Class and its css Attributes in the Page.



function setClassName() {

    var v = document.styleSheets    // Diaply Style Tags in Page
     for (i = 0; i < v.Length; i++) {
           var w = document.styleSheets[0].cssRules     // Also Array of Class in that Style TAg
           for (j = o; j < w.Length; j++) {
                w[j].selectorText == "ClassName in Style Tag"
                w[j].style.width = "100px";   /// Set width in Class of Style, 
                                                               all style attribute can got from here
           }
      }

   }

No comments:

Post a comment