Javascript examples for DOM HTML Element:Image
change an image once after a number of seconds
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// ww w . j a v a2 s . c o m setTimeout(function(){ document.getElementById("img1").src = "http://www.java2s.com/style/download.png"; console.log("The image changed after 1 second (1000 ms)") }, 1000); } </script> </head> <body> <img id="img1" src="https://picsum.photos/200/200/?random"> </body> </html>