JavaScript Reference/Javascript Methods/removeRule

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

"removeRule()" Example

    
<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>



"removeRule()" is applied to

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



"removeRule()" Syntax, Parameters and Note

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.