Change image src
<html> <head> <title></title> <script type="text/javascript"> function procImage() { var img = document.images[0]; var imgAttr = img.align + " " + img.alt + " " + img.src + " " + img.width + " " + img.height; alert(imgAttr); img.src="http://www.java2s.com/style/logo.png"; img.width="100"; img.height="100"; img.alt="Alternative"; img.align="left"; img.title="Upright"; imgAttr = img.align + " " + img.alt + " " + img.src + " " + img.width + " " + img.height; alert(imgAttr); document.close(); } </script> <body onload="procImage();"> <img src="asdf.gif" alt="asdf" /> </body> </html>