Revision: 49725
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 28, 2011 17:34 by a1ias
Initial Code
function randomImage(imgArr) { var imgSrc, imgW, imgH, r; r = Math.floor(Math.random()*(imgArr.length / 3))-1; imgSrc = imgArr[r * 3]; imgW = imgArr[(r * 3)+1]; imgH = imgArr[(r * 3)+2]; document.write('<IMG SRC='+imgSrc+' WIDTH='+imgW+' HEIGHT='+imgH+'>'); }
Initial URL
Initial Description
Usage example: randomImage(['0.gif',50,50,'1.gif',25,25,'2.gif',50,25]);
Initial Title
Show random image using Javascript
Initial Tags
Initial Language
JavaScript