Hey, thanks for that code for that back button thing, hope this will help you.
It can open a page every x seconds, but if you open a page with this code that tries to open another page something doesnt work ... sure you can figure it out.
Its just a little bit messy
<HTML>
<HEAD>
</HEAD>
<body onLoad="time_spent()" >
<SCRIPT language=JavaScript>
<!--
var startDate = new Date();
var startTime = startDate.getTime();
// THIS FUNCTION CALCULATES THE SECONDS ELAPSED SINCE THE PAGE WAS LOADED
function seconds_elapsed () {
var date_now = new Date ();
var time_now = date_now.getTime ();
var time_diff = time_now - startTime;
var seconds_elapsed = Math.floor ( time_diff / 1000 );
// NB NB change the second argument for window.open , because if a window is open
// with the same value as one you are trying to open it doesnt open.
if (seconds_elapsed == 2) {
winpopup = window.open('test2.html','popup2','height=500,width=400,screenX=100,screenY=0,left=100,top=0');
}
if (seconds_elapsed == 4) {
winpopup = window.open('test2.html','popup4','height=500,width=400,screenX=100,screenY=0,left=500,top=0');
}
if (seconds_elapsed == 6) {
winpopup = window.open('test2.html','popup6','height=500,width=400,screenX=100,screenY=0,left=100,top=500');
}
if (seconds_elapsed == 8) {
winpopup = window.open('test2.html','popup8','height=500,width=400,screenX=100,screenY=0,left=500,top=500');
}
if (seconds_elapsed == 10) {
winpopup = window.open('test2.html','popup10','height=500,width=400,screenX=100,screenY=0,left=250,top=250');
}
// window.close();
return ( seconds_elapsed );
}
// THIS FUNCTION TAKES THE SECONDS ELAPSED AND CONVERTS THEM FOR OUTPUT
function time_spent () {
// TAKE THE SECONDS ELAPSED
var secs = seconds_elapsed ();
// CONVERT SECONDS TO MINUTES AND SECONDS
var mins = Math.floor ( secs / 60 );
secs -= mins * 60;
// CONVERT MINUTES TO HOURS AND MINUTES
var hour = Math.floor ( mins / 60 );
mins -= hour * 60;
// DISPLAY THE FINAL OUTPUT TIME STRING
document.display.timeElapsed.value = pad ( hour ) + ":" + pad ( mins ) + ":" + pad ( secs );
// RECURSIVELY RE-RUN THE FUNCTION EVERY SECOND
setTimeout( "time_spent ()", 1000 );
}
// THIS FUNCTION INSERTS A LEADING ZERO (IF NECESSARY) TO PROVIDE UNIFORM OUTPUT
function pad ( num ){
return ( ( num > 9 ) ? num : "0" + num );
}
-->
</SCRIPT>
<form name="display">
<input name="timeElapsed" type="text" size=8>
</form>
</BODY>
</HTML>