Random Pictures upon Loading

  • Thread starter Thread starter SPR
  • Start date Start date
S

SPR

Morning,

Is there any way to get FP2000 to choose a random picture
from a list, each time the web page loads?

Instead of getting the same image each time someone comes
to the page, I would like it to be slightly different.

Cheers ! :)
 
-----Original Message-----
Morning,
Howdy.

Is there any way to get FP2000 to choose a random
picture from a list, each time the web page loads?

Instead of getting the same image each time someone
comes to the page, I would like it to be slightly
different.

Sure. If you have a Microsoft Web server, you can use
either of the techniques described at:

http://www.interlacken.com/winnt/tips/tipshow.aspx?tip=26

Otherwise, or if you'd just prefer JavaScript, add this
script where you want the variable pictures to apepar.

<script>
pics = new Array("sample10.jpg",
"sample11.jpg",
"sample12.jpg");
curDate = new Date();
curTim = curDate.getTime();
picNum = curTim % pics.length;
document.write("<img src='photos/" + pics[picNum] + "'>");
</script>

Here are two tips to keep in mind when using this script:

o You can specify as many pictures as you want in the
statement that begins on line 2.

o In the second line from the bottom, be sure to specify
the correct path from the page that uses the script
to the folder that contains the pictures.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top