<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>