how to create webpage random image display every second using javascript

<html lang="en"> <head>
<script> var totalCount = 10; function ChangeIt() { window.setTimeout( "ChangeIt()", 2000); var num = Math.floor( Math.random() * totalCount ); document.body.background = 'images/'+num+'.png'; document.body.style.backgroundRepeat = "repeat"; } </script> </head> <body onload="ChangeIt();"></body> </html>

Post a Comment

0 Comments