request for help in countdown timer

This is a discussion on "request for help in countdown timer" within the Classic ASP section. This forum, and the thread "request for help in countdown timer are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 3rd, 2005, 17:38
New Member
Join Date: Sep 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
request for help in countdown timer

hi all, i am currently dtg a quiz module that has only 1 qns per page. the user make his choice then submit the page and the page reloads wit hnext qns. at teh end of the 10 qns, the score will be shown. may i ask if anyone noes how to do a countdown timer from the first page till , eg 10mins. to finish the quiz else the quiz will just end at 10mins?

thanks
Reply With Quote

  #2 (permalink)  
Old Sep 3rd, 2005, 22:56
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
would this not work? ive adapted it slightly from this website. i was thinking you could have this script in a small frame at the top, and adapt it so that in a form box it has the remaining time, instead of the status bar, then after the time it redirects you to the page at the end of the quiz, carrying in the query strings the name or id of the person doing the quiz?

Code: Select all
 
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        window.location="end.asp"
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}
//-->
</SCRIPT>
Reply With Quote
  #3 (permalink)  
Old Sep 4th, 2005, 01:22
New Member
Join Date: Sep 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
reply to help given(query)

hi benbramz, i wanna say thanks for helping me in solving this issue.

at the moment, i call <body onLoad="InitializeTimer()"> to start the timer.
however, there is an issue. as i had set only 1 qns in say "quiz.asp", then wen the first qns is answered, it will reload the page for the next qns. eg to "quizasp?qid=1&userAns=0" and the 2nd qns is then shown.

however, the timer always starts at teh time in sec we had set in the new loaded page. cld there be a way to just let the timer run and not be set back to the predefined time we set in all the pages reloaded?

eg, i set the timer to 60s, it cld hav run to 55s wen the user ans the first qns, when the page reload to teh next qns, the timer is then set again to 60 s instead of continuing from 55s?

thanks!!
Reply With Quote
  #4 (permalink)  
Old Sep 4th, 2005, 12:16
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
yeah i know what u mean, you would have to either have:

A: the timer in a seperate frame at the top of the page,
or
B:could you adapt the timer to carry the remaining time in a query string and then start a fresh timer with the new time....
Reply With Quote
  #5 (permalink)  
Old Sep 4th, 2005, 14:45
New Member
Join Date: Sep 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
yoyo timer query

hi, ok i will try see if possible to update to carry the updated remaining time over, if successful, i will put it up here
thanks
Reply With Quote
Reply

Tags
request, help, countdown, timer

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer won't work gleb JavaScript Forum 1 Sep 12th, 2007 08:43
1st timer hosting questions jimbaines Hosting & Domains 16 Jun 21st, 2007 11:27
1st Timer Here, Back in the game allrightythen Introduce Yourself 7 Jun 19th, 2007 01:17
Javascript Timer spinal007 JavaScript Forum 0 Apr 1st, 2007 15:02
Self Updating Timer. Amin PHP Forum 4 Jun 24th, 2005 18:37


All times are GMT. The time now is 04:55.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43