JavaScript Reference/Javascript Methods/removeRule

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

"removeRule()" Example

   <source lang="javascript">
   

<html> <body> <style>.myClass {background-color:red; font-decoration:bold;}</style> <script language="JavaScript">

   function function1() {
       document.styleSheets[0].removeRule(0);
   }

</script> <button id="myB" onclick="function1();" class="myClass">Remove rule</button> </body> </html>


     </source>
   
  


"removeRule()" is applied to

   <source lang="javascript">

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

     </source>
   
  


"removeRule()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Removes a rule from the specified style sheet.

Syntax:

document.styleSheets[index].removeRule(param1) Parameters:

   param1   Optional; the index of the rule within the rules collection.
   
     
     </source>