Activity Stream
48,167 MEMBERS
6953 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 5 of 5
  1.     
    #1
    Banned
    Website's:
    CuraShare.Net CuraShare.Me CuraShare.Info

    Default HELP: Java countdown

    Hi,

    I'm not familiar with JAVA so I'm hoping someone can help me with this. I need to have a countdown script that will display the amount of days/hours/minutes/seconds remaining. PHP will deliver a variable ($seconds) with the amount of seconds.

    Thanks in advance.
    CuraHack Reviewed by CuraHack on . HELP: Java countdown Hi, I'm not familiar with JAVA so I'm hoping someone can help me with this. I need to have a countdown script that will display the amount of days/hours/minutes/seconds remaining. PHP will deliver a variable ($seconds) with the amount of seconds. Thanks in advance. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    You need code in Javascript or php ?

    I have to check my skool note book..have done this in skool project

  4.     
    #3
    Banned
    Website's:
    CuraShare.Net CuraShare.Me CuraShare.Info
    javascript I suppose, it has to count down automatically. I found this, but I have no clue how to use it, can someone instruct me?

  5.     
    #4
    Member
    Just read in shout box that you have css

    copy this part into your css section of HTML
    #txt {
    border:none;
    font-family:Arial; <=== you can change font style
    font-size:20pt; <== change the font size watever size u want
    font-weight:bold; <== bold italic watevre u choose
    border-right-color:#FFFFFF <== color code
    }
    For time clock
    set 2..copy and paste this in your javascipt

    var mins
    var secs;

    function cd() {
    mins = 1 * m("10"); // <= u can change minutes here
    secs = 0 + s(":01"); // <= u can change seconds here (always add an additional second to your total)
    redo();
    }

    function m(obj) {
    for(var i = 0; i < obj.length; i++) {
    if(obj.substring(i, i + 1) == ":")
    break;
    }
    return(obj.substring(0, i));
    }

    function s(obj) {
    for(var i = 0; i < obj.length; i++) {
    if(obj.substring(i, i + 1) == ":")
    break;
    }
    return(obj.substring(i + 1, obj.length));
    }

    function dis(mins,secs) {
    var disp;
    if(mins <= 9) {
    disp = " 0";
    } else {
    disp = " ";
    }
    disp += mins + ":";
    if(secs <= 9) {
    disp += "0" + secs;
    } else {
    disp += secs;
    }
    return(disp);
    }

    function redo() {
    secs--;
    if(secs == -1) {
    secs = 59;
    mins--;
    }
    document.cd.disp.value = dis(mins,secs); //<== if you want to setup additional displays here.
    if((mins == 0) && (secs == 0)) {
    window.alert("Time is up. Press OK to continue."); // <== you can put ur timeout message as want but in the ()
    // window.location = "yourpage.htm" //<== this redirects to specified page once timer ends and ok button is hit
    } else {
    cd = setTimeout("redo()",1000);
    }
    }

    function init() {
    cd();
    }
    window.onload = init;
    Once you copy the above post...Just paste it in notepad and save as countdown.js

    Now...Copy this code in the head of your html page

    <script type="text/javascript" src="countDown.js"></script>
    example <head> <script type="text/javascript" src="countDown.js"></script>

    </head>

    copy this code into ur html body section

    <form name="cd">
    <input id="txt" readonly="true" type="text" value="10:00" border="0" name="disp">
    </form>
    example <body> above line
    This will alert user with pop up once timer end and if you give redirect path..it will take the user to your given link once they hit Ok button in pop up alert...you can omit that [part if you dunt need.
    Hope this help..Let me know if any error occurs


    P.S : The text after //<== .... is just for instruction ..if you can delete them when you paste in notepad

    for ex : window.alert("Time is up. Press OK to continue."); // <== you can put ur timeout message as want but in the ()

    Delete from this line : // <== you can put ur timeout message as want but in the ()

    Make sure you upload your countdown.js file on ur host.

    excuse me : I am not English native.

  6.     
    #5
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    You can use JQuery and a plugin to do the countdown JS.

    Pass the seconds in by PHP by putting it in the call, e.g.
    Code: 
    someDate.setSeconds(<?php echo $seconds; ?>);
    Assuming the script containing $seconds is the same one which outputs the page you want to show the countdown on.

    See here:
    http://jsfiddle.net/8UYZP/1/

    Note: in this example, I assumed $seconds its how many seconds into the future. Though you probably mean it's a unix timestamp of a date in the future.

    FYI the comment in the code says one hour ahead, but its actually one day, I changed it last minute.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Countdown comments
    By r00ts in forum Wordpress
    Replies: 0
    Last Post: 29th Sep 2012, 10:47 AM
  2. Java stinks: Turn off your Java browser plugin
    By Loget in forum General Discussion
    Replies: 37
    Last Post: 5th Sep 2012, 07:40 AM
  3. Need Help HTML/Java Script Twitter/Countdown fixing
    By Andy~s in forum Web Development Area
    Replies: 0
    Last Post: 19th Dec 2010, 06:29 PM
  4. The Google Countdown
    By Angeix in forum General Discussion
    Replies: 9
    Last Post: 14th Dec 2009, 11:37 AM
  5. openSUSE 11.2 countdown (:
    By Hyperz in forum General Discussion
    Replies: 30
    Last Post: 19th Nov 2009, 12:08 AM

Tags for this Thread

BE SOCIAL