Click to See Complete Forum and Search --> : banner rotation


Faliol
02-19-2003, 04:41 PM
Hello,

I am incorporating a banner ad rotation on this site Im working on and i got it working but the first banner is not loading up right off when the page loads;its adding the time between each banner to the beginning..how do you get this code to make the banner come right up? I got the code from Javascriptsource.com I pasted the code they used below.

The site Im using this on is at http://www.onqtech.com/test/
(banner is at top, in top frame)


Thanks!

Kevin



---------------------
<!-- TWO STEPS TO INSTALL BANNER ROTATER:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Markus Fischer (mfischer@josefine.ben.tuwien.ac.at) -->
<!-- Web Site: http://josefine.ben.tuwien.ac.at/~mfischer/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var mfBanners = [
['http://www.banner1-url-here.com', 'http://imageserv.imgis.com/images/Ad13700St1Sz1Sq1_Ban1.gif'],
['http://www.banner2-url-here.com', 'http://imageserv.imgis.com/images/Ad13189St1Sz1Sq5_Ban10.gif']
];
var mfIe = false;
if( document.all) {
mfIe = true;
}
var mfBannerIndex = 0;
function mfBannerChange() {
var htmlString = '<a target="_blank" href="'+mfBanners[mfBannerIndex][0]+'"> <img border="0" src="'+mfBanners[mfBannerIndex][1]+'"></a>';
if( mfIe) {
document.all.banner.innerHTML = htmlString;
}
else {
document.layers["banner"].document.open();
document.layers["banner"].document.write( htmlString);
document.layers["banner"].document.close();
}
if(mfBannerIndex < mfBanners.length - 1)
mfBannerIndex++;
else
mfBannerIndex = 0;
}
setInterval("mfBannerChange()", 5000);
// End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<div id="banner" style="position:absolute; top:300; left:171;"></div>


<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.74 KB -->

pyro
02-19-2003, 05:45 PM
All you need to do is include your second banner in the <div> tag, like this:

<div id="banner" style="position:absolute; top:300; left:171;">
<a target="_blank" href="http://www.banner2-url-here.com"> <img border="0" src="http://imageserv.imgis.com/images/Ad13189St1Sz1Sq5_Ban10.gif"></a>
</div>NOTE: you include the second banner because after 5 seconds, it is going to switch to the first banner in your list.