JavaScript Reference/Javascript Properties/media
Версия от 18:30, 25 мая 2010; (обсуждение)
Содержание
"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