Random photo

Joined
Aug 11, 2005
Messages
285
Reaction score
6
Points
18
On my webpage I have a rectangle with my "photo of the day" I have had to change it manually everyday. But I want to make it so when somebody comes to my webpage it will just randomly change when they access the page, it doesnt even have to be daily, just everytime the page is accessed the photo will change. If I put all of the photos I want it to cycle through ina folder on my server how would I do it, I dont know any php or java, just some html, and if it is something in java is "copy and pastable"
 
Joined
Sep 21, 2005
Messages
809
Reaction score
111
Points
43
Location
ohio
Your Mac's Specs
iBook G4 OSX Tiger
just put it where you want the photos and all you have to do is change the info in orange

<script LANGUAGE="JavaScript">
<!-- Begin
var how_many_ads = 2;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
txt="";
url="http://url the image links to";
alt="image label";
banner="url of the image itself (ex. http:/ /website.com/imageurl.jpg)";
width="x";
height="x";
}
if (ad==2) {
txt="";
url="http://url the image links to";
alt="image label";
banner="url of the image itself (ex. http:/ /website.com/imageurl.jpg)";
width="x";
height="x";
} HERE
document.write('<center>');
document.write('<a href=\"' + url + '\" target=\"_top\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0><br>');
document.write('<small>' + txt + '</small></a>');
document.write('</center>');
// End -->
</script>



to add more than 2 add the following where it says HERE and change the numbers to the necessary numbers (dont forget to remove the HERE )

if (ad==2) {
txt="";
url="http://url the image links to";
alt="image label";
banner="url of the image itself (ex. http:/ /website.com/imageurl.jpg)";
width="x";
height="x";
}
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top