Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Randomize a splash page

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, i need some help on how to randomize a splash page that i want to do. Here's the scenario that i want to happen. Every time a user comes to my site, the splash page will show a different page containing a picture and a few words. I probably have to use an access database to put everything in a record and have it sent to a new order or something like that. I hope this makes sense to someone. If you still know what I am talking about, head on over to and hit the refresh button a couple of times. Thanks for the support and help. Anything would be appreciated or even the code itself.
 
Here is a little script. I don't remember where or when I picked it up but if you put it in table you can position it within a table on your default or index page. If you use a spliced image you can cut down your load time. This script is also able to be configured to use text links within the script. I use it most commonly (as you can probably tell by the image size) for banner ads but it is very configurable. It will also eliminate the need for a database. Hope this helps.

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
txt=&quot;&quot;;
url=&quot;alt=&quot;Image 1&quot;;
banner=&quot;width=&quot;468&quot;;
height=&quot;60&quot;;
}
if (ad==2) {
txt=&quot;&quot;;
url=&quot;alt=&quot;Image 2&quot;;
banner=&quot;width=&quot;468&quot;;
height=&quot;60&quot;;
}
if (ad==3) {
txt=&quot;&quot;;
url=&quot;alt=&quot;Image 3&quot;;
banner=&quot;width=&quot;468&quot;;
height=&quot;60&quot;;
}
document.write('<center>');
document.write('<a href=\&quot;' + url + '\&quot; target=\&quot;_top\&quot;>');
document.write('<img src=\&quot;' + banner + '\&quot; width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\&quot;' + alt + '\&quot; border=0><br>');
document.write('<small>' + txt + '</small></a>');
document.write('</center>');
</SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top