<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>Document</title> <script type="text/javascript"> var i=0; function onload(){ setInterval('changeImage()',2000); } function changeImage(){ var p_w_picpathss=['3.png','4.png','5.png','6.png']; document.getElementById('myImage').src=p_w_picpathss[i]; i++; if(i==4) { i=0; } } </script> </head> <body onload="onload()"> <div> <img id="myImage" src="3.png" alt="" /> </div> </body> </html>