Javascript examples for DOM HTML Element:Image
Change image in sequence from list
<html> <head></head> <body> <img src="logo.png" id="target"> <script language="javascript"> var counter = 0;//w w w . j a v a 2s . c o m var images = ["logo.png", "222.jpg"]; function myFunction() { counter++; if (counter > 1) { counter = 0 } target = document.getElementById("target").src = images[counter]; } function my2(){ setInterval("myFunction()", 1000); } window.onload = function(){ my2(); } </script> </body> </html>