JavaScript Reference/Javascript Properties/src — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:21, 26 мая 2010
"src" Example
<html>
<body>
<img id="myImg" src="" alt="" onClick="function1();">
<button onclick="function1();">Click here to load image</button>
<script language="JavaScript">
function function1() {
document.all.myImg.src = "yourimage.gif";
}
</script>
</body>
</html>
"src" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<applet> <bgsound> |
| |<embed> |
| |<frame> <iframe> |
| |<img> <input type="image"> |
| |<script> <xml> |
+----------------+--------------------------------------------------------------+
"src" Syntax and Note
Note:
Read and write property.
Specifies the URL of the source of the object.
Syntax:
document.getElementById("elementID").src = value
document.all.elementID.src = value // IE only