Hi emrys!
I call the following a brutish aproach since you pop up lots of windows - i personally hate that.
you of course could send all the stuff to only one window, but it has to be a separate one to avoid the referred site putting themselves into the _top frame and getting rid of you framework...
that woulndt solve your problem.
so hae a look at this, maybe it helps.
<html>
<head>
<title></title>
<script language=javascript>
<!--
//array to keep track of the sites
// in [0] URL
// in [1] if it is active (1) or not (0)
arr_controlled_sites = new Array();
arr_controlled_sites[0] = new Array("www.phpbuilder.com","www.cnn.com","www.nzz.ch","www.something.com");
arr_controlled_sites[1] = new Array("0","0","0","0");
function func_check_sites(){
//have a look which of the windows opened are still in existence
//if it has been closed, set value in array [1] to "0"
for(x = 0; x < arr_controlled_sites[0].length; x++){
eval("if(arr_controlled_sites[1][" + x + "] == \"1\" && winhandler_" + x + ".closed){arr_controlled_sites[1][" + x + "] = \"0\";}");
}
var_current_timeout = window.setTimeout("func_check_sites()", 1000);
}
function func_open_site(arg_called_site_id){
eval("winhandler_" + arg_called_site_id + " = window.open(\"http://" + arr_controlled_sites[0][arg_called_site_id] + "\",\"win_site_" + arg_called_site_id + "\",\"scrollbars=yes, resizable=yes, dependent=yes\");");
arr_controlled_sites[1][arg_called_site_id] = "1";
var_current_timeout = window.setTimeout("func_check_sites()", 1000);
}
//-->
</script>
</head>
<body>
Of course it would be elegant to automatize this so you have to change only the table... php should be right for that.<br>
<a href="javascript:func_open_site(0);">Site 1</a><br>
<a href="javascript:func_open_site(1);">Site 2</a><br>
<a href="javascript:func_open_site(2);">Site 3</a><br>
<a href="javascript:func_open_site(3);">Site 4</a><br>
<a href="javascript:window.clearTimeOut(var_current_timeout);">ccc</a>
</body>
</html>
i haven't checked but my book says that the syntax should work with all browsers...
i bet it wont but that's my paranoia ...eh... javascript experience speaking. 😉
so if you want to do something useful with it add an invisible form where you count which links were called how often....
to do that you simply have to change the values of the form elements - which youll generate dynamically - everytime the entry in [1] is changed....
you even could log the order in which the sites have been called if you want....
well, i hope you get the meaning.
what you really should do is killing the timeout in a more elegant way than i did...
but that depends on your page design, just dont forget it. 🙂
ah, and take care to put the evals in one line else nothing will work.
if i can help you further, go ahead.
greetings, jakob