how to add current time and random images in FrontPage?

T

Tribby

I need to add the current time and date as well as random images whenever the
page is refreshed. I don't know if Frontpage 2003 has those capabilities.
If you know how to do it please share the info. THanks
 
J

Jim Buyens

The following script displays the current date and time on the Web visitor's
computer.

<script>document.write(new Date());</script>

and this one displays one of thee random pictures.

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

If you want more than three pictures, just enlarge the array.

If the path from your web page to the folder that contains the pictures is
other than images/, you'll need to adjust that, too.

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)
|/---------------------------------------------------
*----------------------------------------------------
 
Top