Can someone link me to a script that will rotate an ad banner on a website so a different ad appears when you refresh or revisit the page. I have a found a few scripts that rotate images but it has to be able to have the link with it too. Thanks.

Recommended Answers

All 4 Replies

Member Avatar for GreenDay2001

Which one do you want ASP, PHP, javascript.

Javascript preferably, or else php. Thanks!

Got it, thanks though!

<SCRIPT language=JavaScript>
 | Ad Simple                 Copyright   |
 | This program may be used and hosted free of charge by   |
 |anyone for personal purpose as long as this copyright    |
 |notice remains intact.                                   |

var img_width = "468";
var img_height = "60";
var img_title = "Click Here";

var ad=new Array()
//insert here your images src

var links=new Array()
//insert here your links

var xy=Math.floor(Math.random()*ad.length);
document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'" border="0"></a>');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.