JavaScript Reference/Javascript Properties/src
"src" Example
<source lang="javascript">
<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>
</source>
"src" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<applet> <bgsound> | | |<embed> | | |<frame> <iframe> | | |<img> <input type="image"> | | |<script> <xml> | +----------------+--------------------------------------------------------------+
</source>
"src" Syntax and Note
<source lang="javascript">
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
</source>