Advertisement
Guest User

Untitled

a guest
Mar 1st, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. var theImages = new Array()
  2. theImages[0] = 'img/CMbl.png'
  3. theImages[1] = 'img/CMo.png'
  4. theImages[2] = 'img/CMg.png'
  5. theImages[3] = 'img/CMp.png'
  6. theImages[4] = 'img/CMblu.png'
  7.  
  8. var j = 0
  9. var p = theImages.length;
  10.  
  11. var preBuffer = new Array()
  12. for (i = 0; i < p; i++){
  13. preBuffer[i] = new Image()
  14. preBuffer[i].src = theImages[i]
  15. }
  16.  
  17. var whichImage = Math.round(Math.random()*(p-1));
  18. function showImage(){
  19. document.write('<img src="'+theImages[whichImage]+'">');
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement