Log in

View Full Version : popup rotation not working in firefox



SwordOfWar
06-19-2008, 12:27 AM
I'm using the following code to display random pages in a single popup and rotating them by refreshing the code page that spawns the popup (this results in a single popup which rotates pages)... The problem I am having is that for some reason this code is only working under IE and not firefox.

Anyone who can edit the code below to support firefox would be great.


<META HTTP-EQUIV="refresh" content="5">
<SCRIPT language=JavaScript>


var switchto = 1; // set to 1 = PopUp, 2 = Exit Console
var under = 0; // set to 1 to make it pop Under
var resize = 0; // set to 1 to resize main window

var url=new Array();
url[0]= "http://www.link1.com";
url[1]= "http://www.link2.com";
url[2]= "http://www.link3.com";

//no need to change anything below this line

var id = Math.floor(Math.random()*url.length);

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],'RotationPopup','height=500, width=500');
if(under == 1) self.focus();
if(resize == 1) self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);

</SCRIPT>