"Peter A. Berger Jr." <
[email protected]> wrote in message
I don't really want to get into scripting CGI/PHP (I'm a hardware dude...not
a programmer) I'm not trying to get thaaat fancy...I would just like to have
FP randomly choose a picture from a picture depot each day (24hrs) and have
it change at 0000hrs ET server time. Preferably some small picture
dimensions to have the default page load quickly...but if that's not
possible the original picture size/resolution will work fine. Thanks for the
tips/help.
This script is a little awkward, but try inserting it where you want
each day's chosen picture to appear.
<script>
pics = new Array("sample10.jpg", "sample11.jpg", "sample12.jpg");
curDate = new Date();
curDate.setMinutes(curDate.getMinutes() + curDate.getTimezoneOffset()
- 300);
curDay = curDate.getDay();
picNum = curDay % pics.length;
document.write("<img src='photos/" + pics[picNum] + "'>");
</script>
Modify the list of pictures in line 2 to include the pictures you
want. There can be as few as 2 or as many as 31.
The value 300 near the end of line four specifies the number of
minutes difference between server time and GMT time. That statement
gets the number of minutes in the local time, adds the offset in
minutes from GMT to local time, and subtracts the offset in minutes
from GMT to the server's time. It then "crams" this value into the
Minutes field of the curDate object (which, up until then, contained
the current date and time). Setting the Minutes field to a negative
value or a value greater than 59 updates the day, month, and year as
necessary.
All this is dependent on the visitor having configured the time on
their computer correctly. That's a risk, but it's the best I can do
without running anything on the server.
The script chooses a date by dividing the current day of the month by
the number of pictures, and using the remainder to subscript the array
of picture names. So, if you have five pictures, they'll appear as
follows:
Day of Month Remainder Picture Number
------------ --------- -------------
1 1 2
2 2 3
3 3 4
4 4 5
5 0 1
6 1 2
7 2 3
and so forth.
Be sure to correct the path in the next-to-last line so it points to
the correct folder on your server.
P.S: I don't use the newsgroups often, but I do find them an invaluable
resource that keeps people interested in these products. They are great for
quick help. Thanks.
Good luck with your site.
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)
|/---------------------------------------------------
----------------------------------------------------