The Arcive of vBulletin Modifications Site. |
|
Banner rotation Details »»
|
|||||||||||||||||||||||||
sorry too brin this subject up again but i couldnt find a script that changes every 10th time that u visit any1 got any ideas?
If not anyone got a good java script that just changes the the banner i only want it too change between the 2 changing each time u visit the site not every 20 secs blah blah.. Thx Crazy Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
cmon there must be some j-script wizard
|
|
#3
|
||||
|
||||
|
<a href="http://www.spoono.com/codebase/php/?link=Ad" target="_blank">http://www.spoono.com/codebase/php/?link=Ad</a>
|
|
#4
|
|||
|
|||
|
cool but that aint really javascript
|
|
#5
|
||||
|
||||
|
u don't need JavaScript... why use it? PHP is much better
|
|
#6
|
|||
|
|||
|
yea but i want too add the script too the top ov me style
|
|
#7
|
|||
|
|||
|
Code:
// banner rotate in JS
var currentdate = 0;
var core = 0;
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
rand = getRandomNum(10000,999999);
// Array of links and images
link = new initArray(
"/cgi-bin/ads.pl?banner=NonSSI;page="+rand+"",
"/cgi-bin/ads.pl?banner=NonSSI;page="+rand+"",
"http://kansas.valueclick.com/redirect?host=XXXXXXX&size=468x60&b="+rand+"&v=0");
image = new initArray(
"/cgi-bin/ads.pl?page="+rand+"",
"/cgi-bin/ads.pl?page="+rand+"",
"http://kansas.valueclick.com/cycle?host=XXXXXXX&size=468x60&b="+rand+"&noscript=1");
var currentdate = new Date();
var secs = currentdate.getSeconds();
var core = secs % image.length;
var ranlink = link[core];
var ranimage = image[core];
var text = "Click to visit advertiser (a new window will open)";
document.write('<center><a href=\"' +ranlink+ '\" target=\"_blank\">');
document.write('<img src=\"'+ranimage+'\" border=0 width=468 height=60 alt=\"'+text+'\"></a></center>');
|
|
#8
|
|||
|
|||
|
The above JS will select a URL link and image randomly from an array in the code. In my case I use it simply to select from an internal banner ad system and an external one. The rand variable is a randomiser for the ad systems and is not required for simple banner ad rotation.
I call the JS from a template but keep the JS in a server file so that it can be easily changed. |
![]() |
|
|