Help - Search - Members - Calendar
Full Version: whats the code for ...
Forums > Resource Center > Webmasters' Corner > Webmasters' Corner Resolved Topics
miszxjojo
so you know on some sites they have these ads [other sites buttons] and when the page refreshes, theres a different button? what is the code for that? i found it once but i forgot where i found it :[
newkidontheblock
Different people uses different things. Some people might use a PHP mysql database
and do something like this.
CODE
SELECT column FROM table
ORDER BY RAND()
LIMIT 1
http://www.petefreitag.com/item/466.cfm
Mikeplyts
You can also try using this tutorial. thumbsup.gif
fixtatik
there's also an older article about this on a list apart. it's written in PHP, so even if your visitors have javascript turned off, they'll still be able to see and click on the images. (that's assuming of course, you have PHP installed on your server.)
theerinkal
CODE




<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) {
url="URL HERE";
alt="Alt Text";
banner="BANNER URL HERE";
width="88";
height="34";
}
if (ad==2) {
url="URL HERE";
alt="Alt Text";
banner="BANNER URL HERE";
width="88";
height="34";
}
if (ad==3) {
url="URL HERE";
alt="Alt Text";
banner="BANNER URL HERE";
width="88";
height="34";
}
if (ad==4) {
url="URL HERE";
alt="Alt Text";
banner="BANNER URL HERE";
width="88";
height="34";
}

document.write('<a href="' + url + '" target="_blank">');
document.write('<img src="' + banner + '" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt="' + alt + '" border=0></a>');
// End -->
</SCRIPT>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.