JavaScript Reference/Javascript Properties/selector

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

"selector" Example

    
<html>
<body>
<style>
@page:first { background-color: red }
@page:left { background-color: blue }
@page:right { background-color: orange }
</style>
<script language="JavaScript">
    function function1() {
        var m = document.styleSheets[0].pages[1];
        var n = m.selector; 
        alert(n); 
    } 
</script>
<input type="button" value="Click here" onclick="function1();">
</body>
</html>



"selector" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |page                                                          |
+----------------+--------------------------------------------------------------+



"selector" Syntax and Note

Note:
Read-only property. 
Returns the set of pages an @page rule applies to.
    
Syntax:
    
document.styleSheets[index1].pages[index2].selector