Web Hosting, Design, & Coding forum

General discussion

Can someone help with a script that rotates a .sfw banner ad

below is the script I am using on my website in the top banner ad space. The ad rotates and works, but the WHOLE page refreshes every time the image rotates to the next. I am adding the code below. if someone can figure out how to stop the page from refreshing and only have the banner ad refresh, I would really appreciate it.

<div id="BannerSpace"></div>
<script language="JavaScript">
// Create arrays to contain all the values
// for links and image locations
var link = new Array
var image = new Array
//number of milliseconds between rotations
var refreshCount = 20000; // 20 seconds





var last_num = -1;
function setAdvertisement()
var random_num = image.length;
// Create a random number between 1 and last number
while (random_num > (image.length -1) || random_num == last_num)
random_num = (Math.round((Math.random()*(image.length-1))))

var str = "<a href='" + link[random_num] + "' target='_blank'><object onClick='javascript:window.open(\"" + link[random_num] + "\", \"_blank\");' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' id='BannerAd' width='468' height='60'><param name='movie' value='" + image[random_num] + "'><param name='bgcolor' value='#FFFFFF'><param name='quality' value='high'><param name='allowscriptaccess' value='samedomain'><embed type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' name='BannerAd' width='468' height='60' src='" + image[random_num] + "' bgcolor='#FFFFFF' quality='high' allowscriptaccess='samedomain'><noembed></noembed></embed></object></a>";

BannerSpace.innerHTML = str;
window.setTimeout(setAdvertisement, 20000);


Discussion is locked
You are posting a reply to: Can someone help with a script that rotates a .sfw banner ad
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Can someone help with a script that rotates a .sfw banner ad
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

Popular Forums

Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


This one tip will help you sleep better tonight

A few seconds are all you need to get a better night's rest.