I am working on adjusting a timer for closing browser windows. The timer works, however, when I change the variable it doesn't seem to really modify the time much. For example, if the variable is set to 5, it close in 12-15 seconds. But if I set to 1, it closes in about 9-11 seconds. I really would like to have it close in about 4-5 seconds. I did try a zero (0) and of course it closed immediately....
Help!!!! Here is the code that I am using....
<script>
function startTime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=1; // Window Timer Variable
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
self.close();}
else{
window.setTimeout("Timer()",10000)}
}
</script>
I also have an onLoad="startTimer();" command in the body. Any advide as to how to get the timer to closer match the variable would be GREAT!!!
Thanks!
Cary
Help!!!! Here is the code that I am using....
<script>
function startTime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=1; // Window Timer Variable
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
self.close();}
else{
window.setTimeout("Timer()",10000)}
}
</script>
I also have an onLoad="startTimer();" command in the body. Any advide as to how to get the timer to closer match the variable would be GREAT!!!
Thanks!
Cary