Empirisoft Support

    Welcome to Empirisoft Support
Results 1 to 6 of 6

Thread: Countdown timer for a single question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    4
    If it's sufficient to have the coundown timer on a HTML-Page inside a custom-Item you could use a little Javascript inside the page.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta name="author" content="stef">

    <script type="text/javascript">
    sec=60;
    min=2;
    function count()
    {

    sec--;
    document.test.tmp.value=min;
    document.test.tmp1.value=sec;

    if(sec>0)
    {
    setTimeout('count()',1000);
    }
    else
    {
    if(min>0)
    {
    min--;
    sec=60;
    setTimeout('count()',1000);
    }
    else
    {
    alert('finish');
    }
    }

    }

    </script>
    </head>
    <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
    <form method="post" name="test">
    <input type="text" name="tmp" readonly /> minutes and <input type="text" name="tmp1" readonly/> seconds to go<br />
    <input type="button" name="varname" value="Continue" onclick="count()">
    </form>
    </body>
    </html>
    This will start the countdown after clicking the Continue-Button.
    If you wish to start the countdown automatically just replace

    <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
    with

    <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000" onload="count()">
    And if you wish to proceed to the next item right after the countdown finished
    replace

    alert('finish');
    with

    document.test.submit();
    To set the time just edit the line
    min=2;
    Don't change
    sec=60;
    unless you want less then a minute.
    of course you can implement this code in every HTML-Site you want and place the Counters everywhere.

    That's it

    Regards
    stef

  2. #2
    Join Date
    Nov 2005
    Posts
    3,328

Similar Threads

  1. Timer in Experiment file without continue button (case 2483)
    By Kristine in forum MediaLab Older Versions: How Do I...
    Replies: 4
    Last Post: 12-12-2015, 08:14 PM
  2. Multiple responses for a single trial
    By purduepsyc in forum DirectRT Older Versions: How Do I...
    Replies: 1
    Last Post: 10-17-2006, 03:24 PM
  3. Single RT with multiple stimuli?
    By jarvis24 in forum DirectRT Older Versions: How Do I...
    Replies: 1
    Last Post: 10-17-2006, 03:21 PM
  4. Collecting Single OR Double Key Presses
    By Jordan in forum DirectRT Older Versions: How Do I...
    Replies: 2
    Last Post: 07-06-2006, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •