Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 2nd, 2005, 08:10 AM
okl okl is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Singapore
Posts: 356 okl User rank is Private First Class (20 - 50 Reputation Level)okl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 h 35 m 41 sec
Reputation Power: 4
Send a message via MSN to okl
Unhappy 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>
  
  

Reply With Quote
  #2  
Old March 2nd, 2005, 09:06 PM
okl okl is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Singapore
Posts: 356 okl User rank is Private First Class (20 - 50 Reputation Level)okl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 h 35 m 41 sec
Reputation Power: 4
Send a message via MSN to okl
Talking

solved myself

Quote:
Originally Posted by okl
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>
   
   

Reply With Quote
  #3  
Old March 2nd, 2005, 09:17 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
I'm glad you got it worked out.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > 10 mins left trigger a popup alert


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway