'src' Example : src « Javascript Properties « JavaScript Reference
- JavaScript Reference
- Javascript Properties
- src
'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>
Related examples in the same category