hello, <SCRIPT language=JavaScript> var switchto = 1; // set to 1 = PopUp, 2 = Exit Console var under = 1; // set to 1 to make it pop Under var resize = 1; // set to 1 to resize main window var url=new Array(); url[0]= "url1"; url[1]= "url2"; url[2]= "url3"; var id = Math.floor(Math.random()*url.length); //no need to change anything below this line function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } if (get_cookie("ConsoleRotator")!="") { switchto = 0; under = 0; resize = 0; } function window_onbeforeunload(){if(switchto == 2) { window.open(url[id]); }} function window_onload(){ for(i=0; i<document.links.length; i++) { document.links.item(i).attachEvent('onclick', OnClick); } for(i=0; i<document.forms.length; i++) { document.forms.item(i).attachEvent('onsubmit', OnClick); }} function OnReset(){switchto = 2;} function OnClick() {switchto = 2;window.setTimeout(OnReset, 4000);} window.attachEvent('onload', window_onload); if(switchto == 2) window.attachEvent('onbeforeunload', window_onbeforeunload); if(switchto == 1) window.open(url[id]); if(under == 1) self.focus(); if(resize == 1) self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight); document.cookie="ConsoleRotator=1"; </SCRIPT> Code (markup): this code allow to open (as a popup or popunder) once per session on of the url[0],url[1],url[2] (rotation). I want to change this to make it open a javascript ad code. Here is a sample ad code: <script type="text/JavaScript" src="xxxxxxxxxxx"></script> Code (markup): I've got three like this, and want to rotate them and display them once per visit. Finally Sorry for my bad english
You mean you want to show an ad in the new window? Just create three pages with your JavaScript ad code and put their URLs here: var url=new Array(); url[0]= "url1"; <- URL 1 url[1]= "url2"; <- URL 2 url[2]= "url3"; <- URL 3 Code (markup):
Nop, forgot the code i've posted. What i want to do is the following : I have 3 ad codes i'm looking for a script which could rotat between those 3 codes, and show them once per user session (every code will be shown once/Ip) the ad code look like this :