PDA

View Full Version : Revolving Advert


malhyp
10-31-2005, 08:17 PM
Revolving Advert
How to do

Hey there, I wanted to know if dreamweaver has a function or extension that lets you insert revolving pictures.
Example: Load a page and one picture comes up. Reload the page and another picutre comes up.
Something similar to a ad banner.

Thanks in advance.

Malcolm.

Creative Insanity
10-31-2005, 08:30 PM
<BODY>
<script LANGUAGE="JavaScript">
<!-- Begin
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="The World's Largest Online Bookstore, Amazon.com";
url="http://www.amazon.com";
alt="amazon.com";
banner="http://imageserv.imgis.com/images/Ad12669St1Sz1Sq1_Ban1.gif";
width="468";
height="60";
}
if (ad==2) {
txt="Palm III by 3Com, in stock!";
url="http://cybershop.com/";
alt="cybershop.com";
banner="http://imageserv.imgis.com/images/Ad13189St1Sz1Sq5_Ban10.gif";
width="468";
height="60";
}
if (ad==3) {
txt="Find it at GoTo.com";
url="http://www.goto.com";
alt="goto.com";
banner="http://imageserv.imgis.com/images/Ad13700St1Sz1Sq1_Ban1.gif";
width="468";
height="60";
}
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>


For more images/banners just duplicate this:
if (ad==3) {
txt="Find it at GoTo.com";
url="http://www.goto.com";
alt="goto.com";
banner="http://imageserv.imgis.com/images/Ad13700St1Sz1Sq1_Ban1.gif";
width="468";
height="60";
}
and increase the
[code]if (ad==3)
each time.

malhyp
11-02-2005, 08:28 PM
Hey there.

Thanks for the Fast reply with some script that actually works first time without too much effort.

Cheers

Thanks again.

Mal R.

Creative Insanity
11-02-2005, 08:35 PM
You are welcome :)