I want my image to display when the button is clicked. When I put the image source in the HTML portion of the code, it always displays.
When I try to access it from the JS portion of the code, I can't.
Can someone please rewrite this code so that it will work and I will then know how to do it?
Thank you.....
- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1 transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Myimage</title>
<script type = "text/javascript">
function showImg() {
var myimg = document.images["image01"] //first image
}
</script>
</head>
<html>
<body>
<img name="image01" src="9.jpg" width="200" height="128" border="0" value= "Show image">
<input type="button" onclick = "showImg()" >
</html>
</body>
</html>



