
March 2nd, 2005, 08:10 AM
|
|
Contributing User
|
|
Join Date: Feb 2005
Location: Singapore
Posts: 356

Time spent in forums: 1 Week 1 h 35 m 41 sec
Reputation Power: 4
|
|
modifing the code - if 10 mins left then popup alert window
hi, how can i modify the script below to popup an alert when the timer left 10mins.
Code:
<SCRIPT LANGUAGE="VBScript">
<!--
Dim intTimerID
Dim hr
Dim min
Dim sec
hr =<%=Session("Hr")%>'change hours
min=<%=Session("Min")%>'change minutes
sec=<%=Session("Sec")%>'change seconds
Sub HandleTime
if hr=0 and min=0 and sec=0 then
endtime
elseif min>=0 and sec>0 then
sec=sec-1
status= "Time Left: " & hr & " hr " & min & " min " & sec & " sec "
intTimerID=setTimeOut("HandleTime",950, "VBScript")
elseif min>0 and sec=0 then
min=min-1
sec=59
status= "Time Left: " & hr & " hr " & min & " min " & sec & " sec "
intTimerID=setTimeOut("HandleTime",950, "VBScript")
elseif hr>=0 and min=0 then
hr=hr-1
min=59
sec=59
status= "Time Left: " & hr & " hr " & min & " min " & sec & " sec "
intTimerID=setTimeOut("HandleTime",950, "VBScript")
end if
document.all.hours.value = Hr
document.all.Mins.value = Min
document.all.Secs.value = Sec
End Sub
Sub endtime
cleartimeout intTimerID
status = "Exam Time Ended"
msgbox "Exam Time Is Up"
Location.href = "end.asp"
end sub
status= "Time Left: " & hr & " hr " & min & " min " & sec & " sec "
intTimerID=setTimeOut("HandleTime",950, "VBScript")
-->
</script>
|