JavaScript Reference/Javascript Properties/media

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

"media" Example

    
<script language="JavaScript">
    function function1() {
        document.all.myL.media = "print";
    }
</script>
<a id="myL" href="" onClick="return false" media="screen">Some link</a>
<input type="button" 
       id="myB" 
       onClick="function1();" 
       value="Change the output media to "print"">
</body>
</html>



"media" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<link>                          <style>                       |
|                |styleSheet                                                    |
+----------------+--------------------------------------------------------------+



"media" Possible Values

Possible Values
screen, 
print, 
all                 (the default).



"media" Syntax and Note

Note:
Read and write property. 
Specifies the output device for the object. 
    
Syntax:
    
document.getElementById("elementID").media = value
document.all.elementID.media = value // IE only
document.styleSheets[index].media = value