Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <script language="javascript">
  2. var delay=1000 //set delay in milliseconds
  3. var curindex = 0
  4.  
  5. var randomimages=new Array()
  6.  
  7. randomimages[0]="1.jpg"
  8. randomimages[1]="3.jpg"
  9. randomimages[2]="2.jpg"
  10.  
  11. document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
  12.  
  13. function rotateImage()
  14. {
  15. curindex = (curindex + 1) % randomimages.length
  16. document.images.defaultimage.src = randomimages[curindex]
  17. }
  18.  
  19. setInterval("rotateImage()", delay)
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement