Exam Countdown timer

Hi Experts!
i just want to ask for your help regarding my timer. I've been working for an exam timer wherein the value of the time will come from a database. in my jsp, I've used hidden fields to retrive the data from the database but when i get the value of the hidden field using javascript, the value return NaN. But the timer is running. Its just that the display time is NaN. Im sure that the hidden fields contains the right value because when i try to make it a textbox, it shows the value. With this scenario, can someone please tell me the possible solution for this code?How can I display the right value in my timer?
here's the code:
var gethr = "<%=request.getAttribute(txt_hr)%>";
var getmin ="<%=request.getAttribute(txt_min)%>";
var sec = "<%=request.getAttribute(txt_se")%>";
var hr= parseInt(gethr);
var min= parseInt(getmin);
var sec= parseInt(getsec);
var lab="timer";
function start() {
displayCountdown(lab);
loaded(lab,start);
var pageLoaded = 0;
function loaded(i,f) {
if (document.getElementById && document.getElementById(i) != null) f();
else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
function calculate(){
sec--;
if (sec == -01)
sec = 59;
min = min - 1;
else { min = min; }
if (sec<=9)
sec = "0" + sec;
if(min==-01)
min=59;
hr= hr-1;
function displayCountdown(timer) {
calculate();
var time = (hr<=9 ? "0" + hr : hr)+" : " + (min<=9 ? "0" + min : min)+" : " + sec ;
document.getElementById(timer).innerHTML =time;
// To check time is over or not
if (hr=='00' && min == '00' && sec == '00')
sec = "00";
alert("stop");
}else{
SD=setTimeout('displayCountdown(\''+timer+'\');',1000);
Any respond will be very much appreciated. Many thanks!! =)
Best Regards,
-- chjylene --

The problem lies at the client side. Make use of client side languages such as Javascript. If you really insist in using Java, rather consider an Applet or [Web Start Application|http://google.com/search?q=jnlp+tutorial+site:sun.com] which you on its turn can embed in your JSP.

Similar Messages

  • Best way to implement a countdown timer for a turn based LCCS game

    Hello,
    I am trying to build a turn based game and sketching out the high level map, so I can focus my efforts towards the direction I should be digging.
    One thing I have not seen much in the sample apps is how a turn based game is best handled.
    For example, a countdown timer. Should it be a shared property? Or a Baton which is supposed to manage workflows and has a timeout property?
    Or, should I forget those two, and time this on the server, although if it would become popular keeping track of all the times in the rooms would cost an arm and leg. Would love to hear some best practices on this.

    good idea.
    Which one or all of them?
    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to
    suffering - Yoda. Blog - http://www.computerprofessions.co.nr

  • How can I make a countdown timer using After Effects

    I'd like to make a video that has a timer that counts down one second at a time. I need one starting at 5:00 (five minutes). Is there a way to easily do this in After Effects without having to manually change the text every second?
    Thanks.

    I'm glad that you found a solution, but I thought that you might appreciate a suggestion of another approach.
    Colin Braley provides a tutorial and example project on
    his website that show how to use an expression on the Source Text property to animate text to overcome some of the limitations of the Numbers effect.
    There's a similar example in the
    "Example: Animate text as a timecode display" section of After Effects Help.
    Here are some Community Help searches that can lead you to some ideas, too:
    Community Help search for 'countdown timer'
    Community Help search for 'digital countdown timer'

  • Countdown Timer Error Msg: "Warning: 1090: Migration issue"

    Hey folks,
    New to Flash here (using CS3), trying to create a countdown
    timer.
    Following is the error message I receive when trying to test
    the
    movie:
    "Warning: 1090: Migration issue: The onEnterFrame is not
    triggered
    automatically by Flash Player at run time in ActionScript
    3.0. You
    must first register this handler for the event using
    addEventListener
    ( 'enterFrame', callback_handler).
    Does anyone know what this means? And please "dumb it down"
    for this newbie. :)
    Following is the actionscript I'm using:
    this.onEnterFrame = function() {
    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
    var targetDate:Date = new Date(2007,5,10);
    var targetTime = targetDate.getTime();
    var timeLeft = targetTime - currentTime;
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hrs = Math.floor(min/60);
    var days = Math.floor(hrs/24);
    sec = String(sec % 60);
    if (sec.length < 2) {
    sec = "0" + sec;
    min = String(min % 60);
    if (min.length < 2) {
    min = "0" + min;
    hrs = String(hrs % 24);
    if (hrs.length < 2) {
    hrs = "0" + hrs;
    days = String(days);
    var counter:String = days + ":" + hrs + ":" + min + ":" +
    sec;
    time_txt.text = counter;
    Thanks in advance!!!

    It just means that you can't do things the "old" way. You
    have to use the
    AS3 event model, like so:
    this.addEventListener("enterFrame", enterFrameHandler);
    function enterFrameHandler(evt:Event) {
    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
    var targetDate:Date = new Date(2007,5,10);
    var targetTime = targetDate.getTime();
    var timeLeft = targetTime - currentTime;
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hrs = Math.floor(min/60);
    var days = Math.floor(hrs/24);
    sec = String(sec % 60);
    if (sec.length < 2) {
    sec = "0" + sec;
    min = String(min % 60);
    if (min.length < 2) {
    min = "0" + min;
    hrs = String(hrs % 24);
    if (hrs.length < 2) {
    hrs = "0" + hrs;
    days = String(days);
    var counter:String = days + ":" + hrs + ":" + min + ":" +
    sec;
    time_txt.text = counter;

  • Javascript countdown timer not working in Safari

    Years ago I copied a Javascript for a countdown timer and it has been working on my website ever since in both Safari and Firefox. I have been working on updating my site and suddenly it stopped working in Safari, but still works in Firefox. Obviously, I'd like it to work in everyone's browser if possible. I've created a page which only has the countdown timer on it. Can anyone tell me what I need to do to get it to work in Safari?
    The test page where you can see this is: http://hyperflite.com/countdowntest.html
    TIA

    Hi,
    Is there any reason for the numerous body tags in there?
    <pre><body onload="doCountdown();">
    <body>
    <body ... >
    </pre>
    I don't have Safari here to test with, but I wouldn't have thought they were helping matters

  • 5 minute countdown timer with 3d extrusion  for AE CC  5:00

    dear  AE  Family,
    Total Newbie here  looking to make a 3d countdown timer in  after effects  CC.  I know how to use the effect  to make the standard timer.  But I want to make the
    3d extrusion  5:00 which looks much better.  My CC came with  cinema 4d  lite but cant seem to put them together. 
    PS  I really need it to look like  5:00  4:59,   to 0:00 . 3d extrusion.
    Thanks in advance, much appreciated.

    Have you gone though Getting Started with After Effects?
    Have you seen the Basic Workflow series?
    Be aware that if you want extruded text with Ray-traced rendering you are going to be in for long render times even with a compatible Cuda card installed and extremely long render times without one.
    The easiest way to make a countdown timer that will work with extruded text is to Google Countdown Timer After Effects and then look for expressions. You will find this popular universal timer expression from Dan Ebberts: Dan Ebberts's Expressioneering Design Guide
    Get that far and get back to us with your problems.
    BTW, there are other ways to mimic 3D extrusions and simple layer effects like Bevel and Emboss or the effect Bevel Alpha that may meet your design idea.

  • How can I create an animated countdown timer?

    Is there a way to create an animated countdown timer in Adobe Fireworks (animated gif)?
    Thank you

    In the Edit workspace, place the images you want to appear in each frame of the animation on separate layers of the Layers panel. For example, to create an animation of an eye blinking, you would place an image of the open eye on one layer, and an image of the closed eye on another layer.
    Choose File > Save for Web.Note: If your image has multiple layers, you can also open the Save For Web dialog box from the Save As dialog box by choosing CompuServe GIF Format and selecting Layers As Frames.
    Optimize the image in GIF format.
    Select Animate.
    Set additional options in the Animation section of the dialog box:
    Loop Continuously repeats the animation in a web browser.
    Frame Delay Specifies the number of seconds that each frame is displayed in a web browser. Use a decimal value to specify fractions of a second. For example, use .5 to specify half a second.

  • How to implement countdown timer in apex

    Hi all,
    I want to implement timer in my application.i am working on apex 4.0 version.I am developing online test application,so for this i want to display timer for test.
    can anyone suggest me how can i implement countdown timer in my application.
    thanks
    jitu

    Hi,
    You can refer "Martin Giffy D'Souza's" Enhanced APEX Session Timeouts example
    http://www.talkapex.com/2009/09/enhanced-apex-session-timeouts.html
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • How to develop a countdown timer in jsp

    Hi all, please i have an online test application that works but i want to include a countdown timer that redirects to another page when the time runs out. please, how do i go about it. please help

    Thanks, but thats not the one i need. i want the one that will show the time in hh:mm:ss and then automatically take the user to the result page when the time i up. i have a javascript code i used but the problem is in the Result.jsp page, there are some parameters that are suppose to be passed but i dont know how to do it. this is the code:
    <form name="frm2" method="post">
    <script language="javascript">
    var sec = 10;   // set the seconds
    var min = 00;   // set the minutes
    var targetURL="result.jsp"; //the url
    var email=this.Field('email').value;
    function countDown() {
      sec--;
      if (sec == -01) {
        sec = 59;
        min = min - 1;
      } else {
       min = min;
    if (sec<=9) { sec = "0" + sec; }
      time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";
    if (document.getElementById) { theTime.innerHTML = time; }
      SD=window.setTimeout("countDown();", 1000);
    if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD);
    window.location=targetURL;
    function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          if (oldonload) {
            oldonload();
          func();
    addLoadEvent(function() {
      countDown();
    </script>
    <table width="100%">
    <tr><b><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></b></tr>
    </table>
    </form>and this is are the fields needed in the Result.jsp page..
    <input type="hidden" name="email" value=<%=exno%> />
    <input type="hidden" name="dbase" value=<%=names%> />
    <input type="hidden" name="tamt" value=<%=total%> />

  • How do i add a countdown timer in as3 that starts when the program begins?

    I also want it to remove everything that is on the stage when it reaches 0 and produce a Game Over screen.

    import flash.events.TimerEvent;
    import flash.utils.Timer;
    var countdown:Timer = new Timer (1000,TARGET_TIME);
    //after 60 Seconds every DisplayObject will be removed from stage
    const TARGET_TIME:int = 60;
    countdown.addEventListener(TimerEvent.TIMER, tick);
    countdown.addEventListener(TimerEvent.TIMER_COMPLETE, gameOver);
    function tick(e:TimerEvent):void {
        //this will count upwards 1.2.3.4....
        trace(e.currentTarget.currentCount);
    function gameOver(e:TimerEvent):void {
        // this function will remove all DisplayObjects from your Stage
        // starting from the top
        //It will not remove shapes or anything the user might have drawn on the stage
        //just things that are accessible to ActionScript (Sprites, MovieClips)
        for (var i:int = this.numChildren-1 ; i >= 0; i--) {
            removeChildAt(i);
    //countdown will start only if you call it explicitly
    countdown.start();

  • How to create countdown timer with sound

    Any ideas on how to create a minute and seconds countdown timer that would play a sound and then redirect you to another page?

    Hi,
    There is no out of the box solution to do so in Muse at the moment. If you can get your own code, you can add it to your site using "Insert HTML" feature.
    Regards,
    Aish

  • Need help on countdown timer!

    Could someone please guide me in the direction as to how to make a countdown timer?  I created a timer that counts down to a certain date, but I just want the timer to countdown 24 hours, not to a certain date.  I also want to have a button below the timer so that when you click it, it adds 30 seconds to the timer.  Can anyone help me with this?

    Hi,
    I hope it will be use full for u....
    var timelong=2000;
    var mytimer:Timer=new Timer(timelong,1);
    mytimer.addEventListener(TimerEvent.TIMER_COMPLETE,myfunc);
    mytimer.start();
    function myfunc(event:TimerEvent)
        trace("hi it's working");
    mybut.addEventListener(MouseEvent.CLICK,addtime);
    function addtime(event:MouseEvent)
        timelong+=3000;
    Thanks,
    K Swamy Vishnubhatla,

  • Countdown Timer

    Can anyone gve me any advice on how to make a countdown timer
    in actionscript 3?
    I have tried several ways and have so far been
    unsucessful.

    Here's something simple:
    var endDate:Date = new Date(2012, 11, 21);
    var t:Timer = new Timer(500);
    t.addEventListener(TimerEvent.TIMER, msLeft);
    t.start();
    function msLeft(e:TimerEvent){
    var now:Date = new Date();
    var ms = endDate.valueOf() - now.valueOf();
    var secs = Math.floor((ms / 1000) % 60);
    var mins = Math.floor((ms / 1000 / 60) % 60);
    var hours = Math.floor((ms / 1000 / 60 / 60) % 24);
    var days = Math.floor((ms / 1000 / 60 / 60 / 24) % 365);
    var years = Math.floor(ms / 1000 / 60 / 60 / 24 / 365);
    trace(years, "years", days, "days", hours, "hours", mins,
    "minutes", secs,
    "seconds");
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Countdown timer to NEXT WHOLE HOUR..?

    Hello.
    I need to create a countdown timer function.
    Normally that would not be a problem for me, but this timer needs to countdown to the next whole hour. As an example, if the time is 23:42 the countdown would say 17:35 (17 minutes, 35 seconds).
    When the timer hits zero, it will start from 59:59 and so on.. Always counting to the next whole hour.
    Im kind of in a jam and need this done ASAP, any help would be greatly apreciated!
    / Rasmus

    Im sorry if i implied that im a great actionscripter, im not
    What i would normally do is just grab a counter script from a google search and modify it to countdown to the correct time, but i havent been able to find a counter that counts down to the next whole hour.
    It should just be plain and simple and display the time in minutes and seconds like this: 25:14
    I found this one on google, counting down for christmas. If that could be modded into showing only minutes and seconds and of course counting down to the next whole hour, that would be awsome!
    https://dl.dropbox.com/u/2628604/countdown-test.fla

  • Insert a countdown timer in Keynote?

    Hello all,
    I'm sure this is an included feature that I just can't find somehow. I would like to insert a countdown timer into a slide. This seems pretty common; I've seen it done a lot. But I just can't find the Insert>timer link, or anything like it. And the iWork help file is forever searching and never going anywhere (second, embedded problem), so I can't search there.
    I tried the iPresentee thing, but it didn't download properly. Plus, it seems like a basic feature available for a presenter, especially since there's a timer included in the Presenter view.
    Any help would be appreciated. Thanks.

    d moon,
    Keynote does not provide any countdown timer features. You need to seek third parties for them.
    The iPresentee timers are a good start - their website provides a free "goodie" of timers in the form of a Keynote File where many choices of timers are available. Try downloading the file again or contact iPresentee for assistance.
    Each Timer is actually a Quicktime video clip. You select the one with the closest time range to your needs, copy it to your presentation and adjust the start point.
    Keynote > Inspector > Quicktime > Start & Stop controls

Maybe you are looking for

  • SSO to a website with applet as a home page

    Hi, we have a scenario in which we need to setup a SSO to a website which has applet as its homepage. I am trying to use the application integrator. did anybody else implemented this scenario, if so, could you please share your experiences or ideas w

  • MacBook Air mid-2013 OSX 10.9.1 cannot connect to DVI Monitor

    Does anyone else have this problem?  I've seen similar issues raised, but so far can't find a solution to my particular issue: MacBook Air Mid 2013 (ordered Jan 2014) - 1.3GHz Intel Core i5 - 8GB 1600MHz DDR3 RAM - OSX 10.9.1 Mavericks. When I connec

  • How would I create a simple script that does these specific things?

    I am trying to create a script that does these few simple task but I can't seem to compile all the cmdlets together into one. I can pick one task out and have a command for it but I want one script to do it all. Here are the tasks I need it to do. st

  • HT201302 how can i import photos from iphone to pc

    how can i import photos from iphone to pc?

  • Need Windows 7 Driver for 6920AB1 Monitor

    Hello, My computer was running great until I decided to install windows 7. Same graphics card NVIDIA GeForce 6100, same L192 Wide TFT monitor but now the picture is distorded and I can't find the default resolution setting of 1440x900 on the option b