[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1791
  • Last Modified:

Rotate images upon refresh

How can I design my web page to rotate a new picture into the page upon refresh?  I would like to "cycle" about 8 pics through.  I would like a new one to show up when you refresh the page.  Do you think you can help me?
1 Solution
if this doesn't have to be done specifically in front page, have you tried using the adrotator component that ships with IIS?
There is a banner component that comes with FP, but that does not load a new image upon refresh...it rotates images based on a delay...still, you may wan't to look at that.  If you do not wan't a hyperlink for the image, enter "javascript: void();" as the value of the hyperlink.

Possibly a better way (my choice) would be to load a random image using a little javascript.  Put the following in between the <head> ... </head> tags on the HTML view of your page.  (Assuming ten images, named img1.gif through img10.gif)


rnd.today=new Date();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);

function rand(number) {
        return Math.ceil(rnd()*number);


Where you wish the image to be displayed add this:

document.write('<IMG SRC="img' + rand(10) + '.gif" WIDTH="400" HEIGHT="40">');

shlydenAuthor Commented:
Get answer.  Very informative.  Thank you very much.  You have saved me much time.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now