ok.. so ive been working on a mirror redirect page.... its purpose is to display a list of mirrors, display individual mirror status (online, offline), and then randomly redirect users to one of the ONLINE mirrors.... I have chosen to do it all client side... as users might not have the same access to the mirrors that one of the servers might (ip restrictions, etc).... I am using "online" images located on the mirror to determine its status, and I capture the <img OnError to display "offline" images... so far all works fine....
where it all falls apart is when i try to use the img onerror to set a variable to so that that mirror will not be part of the random redirect... I am not getting any error messages so i do not know exactly what the problem is.... I think that the problem is when i try to set a variable that will inform my redirect script to ignore a mirror......
i may not be explaining it well...... here's the code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function changeImg(which, newimg) {
which.src = newimg;
return;
}
var brinksteronline
var trefdynonline
var awardspaceonline
function SeTTem(setwhat) {
setwhat = "true";
}
var brinkster="http://www30.brinkster.com/oxman/asp/";
var trefdyn="http://tref.dyndns.org:22222/www/asp/";
var trefdyn2="http://tref.dyndns.org:22222/www/php/";
var awardspace="http://lucasbibby.awardspace.com/";
if (brinksteronline == true) {brinkster = trefdyn;}
if (trefdynonline == true) {trefdyn = awardspace; trefdyn2 = awardspace;}
if (awardspaceonline == true) {awardspace = brinkster;}
else {}
var urlarray= new Array(
brinkster,
trefdyn,
trefdyn2,
awardspace);
randomno=Math.floor((Math.random()*urlarray.length));
urlran=urlarray[randomno]
</SCRIPT>
</head>
<BODY>
<table>
<tr><td><center><a href='http://www30.brinkster.com/oxman/asp/'><span style="cursor:hand"> <b>Mirror 2</b><span></a></center></td><td><center>...<img src="http://www30.brinkster.com/oxman/asp/img-bin/misc/online.gif" OnError="SeTTem('brinksteronline'); changeImg(this, 'http://www30.brinkster.com/oxman/asp/img-bin/misc/offline.gif');" alt="status">...</center></td></tr>
<tr><td><center><a href='http://tref.dyndns.org/www/asp/'><span style="cursor:hand"> <b>Mirror 1</b><span></a></center></td><td><center>...<img src="http://tref.dyndns.org/www/asp/img-bin/misc/online.gif" OnError="SeTTem('trefdynonline'); changeImg(this, 'http://www30.brinkster.com/oxman/asp/img-bin/misc/offline.gif');" alt="status">...</center></td></tr>
<tr><td><center><a href='http://tref.dyndns.org/www/php/'><span style="cursor:hand"> <b>Mirror 1</b><span></a></center></td><td><center>...<img src="http://tref.dyndns.org/www/php/img-bin/misc/online.gif" OnError="SeTTem('trefdynonline'); changeImg(this, 'http://www30.brinkster.com/oxman/asp/img-bin/misc/offline.gif');" alt="status">...</center></td></tr>
<tr><td><center><a href='http://lucasbibby.awardspace.com'><span style="cursor:hand"> <b>Mirror 5</b><span></a></center></td><td id="ignore"><center>...<img src="http://lucasbibby.awardspace.com/php/img-bin/misc/online.php" OnError="SeTTem('awardspaceonline'); changeImg(this, 'http://www30.brinkster.com/oxman/asp/img-bin/misc/offline.gif');" alt="status">...</center></td></tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
function go(){
var url=urlran
var target="_self"
window.open(url,target)
}
function wait(delay){
string="pauseforalert("+delay+");";
setTimeout(string,delay);
}
function pauseforalert(delay){
// document.write(urlarray) will be replaced by go();
// once i am sure it works, in the mean time, lets me see the urlarray
document.write(urlarray);
}
wait(5500)
</SCRIPT>
</body>
*note that for testing purposes i have setup mirror 1 to always report offline



Reply With Quote


Bookmarks