Change image
<html> <head> <script type="text/javascript"> function setSrc(){ var x=document.images x[0].src="http://www.java2s.com/style/logoRed.png" } </script> </head> <body> <img src="http://www.java2s.com/style/logo.png" width="107" height="98" /> <form> <input type="button" onclick="setSrc()" value="Change image"> </form> </body> </html>