Jump to content

How to limit an object in simple iframe banner rotation to only be shown once


sfraise

Recommended Posts

I have a simple banner rotation in an iframe that rotates several ads.

What I need to do is have the ability to have some of the objects only load once in the rotation while allowing others to be loaded continuously. Is there a statement I can add to the script to do this? Perhaps I need to set up an array in order to add the extra arguments?

Here's how the script looks:

<iframe name="ad" id="rotate" src="about:blank" scrolling="no" framespacing="0" frameborder="0" marginwidth="1" marginheight="1" border="0" style="width:729px; height:91px"></iframe>
<script language="JavaScript" type="text/javascript"><!--
// Pages to rotate
var pages=new Array('http://www.oohya.net/ads/google.html', 'http://www.oohya.net/ads/amateurmatch.html', 'http://www.oohya.net/ads/adbrite.html');
var rint=5; // Rotation interval
var currentpage=-1;
function rotator(){
currentpage++;
if(currentpage >= pages.length) currentpage=0;
document.all.rotate.src=pages[currentpage];
setTimeout('rotator()', rint * 25000);
}
rotator();
//--></script>
</iframe>

All you have to do is put the ones you want at the beginning and instead of setting

currentpage=0;

on

if(currentpage >= pages.length) currentpage=0;

set it to the index in pages() that is the first banner that is to be rotated continuously.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.