JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 23rd, 2013, 07:11 PM
club777 club777 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2013
Posts: 1 club777 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 55 sec
Reputation Power: 0
Having problems with the script showing up in multiple locations.

Im having problems with the script below.
Im trying to insert the HTML in different areas of my site to place different sizes of rotating banner ads but its only showing me the one size only. Example I inserted the script using the 728x90 banners script and 468x60 banners script. Then the script for the 468x60 is replacing the 728x90 banners so it only shows one.
I was hoping a kind professional could help me make this script that i can insert in more than location in my site.
So the million dollar question is: What is it that i have to change or add or both that i could use this banner rotator script multiple times in the same page??

This is the unedited script.

<script type="text/javascript">
function initArray() {

this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}

link = new initArray(
"",
"",
"",
"",
"",
""
);

image = new initArray(
"",
"",
"",
"",
"",
""
);

text = new initArray(
"Example 1 Title",
"Example 2 Title",
"Example 3 Title",
"Example 4 Title",
"Example 5 Title",
"Example 6 Title"
);

function getRandom(){
var core = Math.floor(Math.random()*6); // amount of items in array
displayBanner(core)
}

function displayBanner(theNum){
var ranlink = link[theNum];
var ranimage = image[theNum];
var rantext = text[theNum];

//document.write('<a href=\"' +ranlink+ '\" target=\"_blank\"><img src=\"'+ranimage+'\" border="0" alt=\"'+rantext+'\"></a>');
document.getElementById('theImg').alt=rantext;
document.getElementById('theImg').src=ranimage;
document.getElementById('theLink').href=ranlink;
}
</script>

<a href="#" target="_blank" id="theLink"><img src="" border="0" alt="" id="theImg"></a>

<script type="text/javascript">
getRandom();
setInterval("getRandom()", 6000);
</script>

Last edited by club777 : May 23rd, 2013 at 10:37 PM. Reason: Adding

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Having problems with the script showing up in multiple locations.


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap