/ Published in: JavaScript
random image loaded on page refresh
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- // please keep these lines on when you copy the source // made by: Nicolas - http://www.javascript-page.com var currentdate = 0 var core = 0 function StringArray (n) { this.length = n; for (var i =1; i <= n; i++) { this[i] = ' ' } } image = new StringArray(8) image[0] = 'images/header/PA021184.JPG' image[1] = 'images/header/PA021188.JPG' image[2] = 'images/header/PA021195.JPG' image[3] = 'images/header/PA021199.JPG' image[4] = 'images/header/PA021207.JPG' image[5] = 'images/header/PA021224.JPG' image[6] = 'images/header/PA021226.JPG' image[7] = 'images/header/PA021234.JPG' var ran = 60/image.length function ranimage() { currentdate = new Date() core = currentdate.getSeconds() core = Math.floor(core/ran) return(image[core]) } document.write("<img src='" +ranimage()+ "'>") //--> </script> <!-- <img class="frontimg" src=" +ranimage()+ " width="700" height="260" /> -->