homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Rotating JavaScript Image Suggestion
ControlZ




msg:1484183
 3:36 am on Mar 28, 2003 (gmt 0)

I am looking for a JavaScript that will load a different image on a new page view. In other words, I would like to have a static image, that changes upon reloads. Does anyone know if this is possible without using cookies?

Any suggestions are much appreciated as well as URLS where I may find such code.

 

toadhall




msg:1484184
 5:35 am on Mar 28, 2003 (gmt 0)

A simple random generator can be used for image rotation:

<script language="JavaScript">
var rand_int = Math.floor(Math.random()*4);
var photos = new Array(4)
photos[0] = '<img src="image1.gif">';
photos[1] = '<img src="image2.gif">';
photos[2] = '<img src="image3.gif">';
photos[3] = '<img src="image4.gif">';
document.write(photos[rand_int]);
</script>

T

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved