JavaScript Reference/Javascript Properties/cssRules

Материал из Web эксперт
Перейти к: навигация, поиск

"cssRules" Example

   <source lang="javascript">
   

<html> <head> <style>

  1. Layer1 {
   font-family:Verdana; 
   color:blue 

} </style> <script language="JavaScript">

   function function1() {
       var n = document.styleSheets[0].cssRules;
       alert(n);
   }

</script> </head> <body>

div element content.

<button onClick="function1();">Click here</button> </body> </html>


     </source>
   
  


"cssRules" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |styleSheet | +----------------+--------------------------------------------------------------+

     </source>
   
  


"cssRules" Syntax and Note

   <source lang="javascript">

Note: Read-only property. Returns an array of style sheet rules. The corresponding IE property is rules.

Syntax:

document.styleSheet[index].cssRules


     </source>