Random Images

liunx

Guest
Sorry for the "noob" question but I've literally searched for this for the last hour and just can't find what I want. I want my page to display 1 of 5 random images each time it is refreshed, I know this can be done with a really simple html code but all I could find on the web was cgi and java ways of doing it, any help would be greatly appreciated, thanks.<!--content-->ok my mates now saying that it's impossible to do with just html, although I am positive I've seen it done before, if so whats the easiest way to do so?<!--content-->Search Google for 'random image JavaScript'. There are a bunch of them. :)<!--content-->It can't be done by HTML but a simple JavaScript should do:<br />
<br />
<br />
<script language="JavaScript"><!--<br />
var images=new Array('image1.gif','image2.gif','image3.gif','image4.gif','image5.gif');<br />
<br />
var pick=Math.floor(Math.random()*images.length);<br />
document.write('<img src=http://www.htmlforums.com/archive/index.php/"'+images[pick]+'" border=0>');<br />
//--></script><!--content-->Originally posted by Jonny Buffalo <br />
Sorry for the "noob" question but I've literally searched for this for the last hour and just can't find what I want. I want my page to display 1 of 5 random images each time it is refreshed, I know this can be done with a really simple html code but all I could find on the web was cgi and java ways of doing it, any help would be greatly appreciated, thanks. An hour? when all you had to do was click on the navigation drop menu at the top right of this page, click on A1 JavaScripts and you would have found one there to suit your needs.<!--content-->
 
Back
Top