Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2011
    Location
    united kingdom
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    javascript timer

    hi guys, ive found the code for the perfect timer but cant for the life of me find the part to change the date to count down from. can anyone point it out? heres the code.


    <script language="JavaScript">
    var countDownInterval=5;
    var countDownTime=countDownInterval+1;
    function countDown(){
    countDownTime--;
    if (countDownTime <=0){
    countDownTime=countDownInterval;
    clearTimeout(counter)
    window.location="file:///E:/................html";
    return
    }
    if (document.all) //if IE 4+
    document.all.countDownText.innerText = countDownTime+" ";
    else if (document.getElementById) //else if NS6+
    document.getElementById("countDownText").innerHTML=countDownTime+" "
    else if (document.layers){
    document.c_reload.document.c_reload2.document.write('WEDDING DAY IN... <b id="countDownText">'+countDownTime+'</b> minutes') </b> seconds')
    document.c_reload.document.c_reload2.document.close()
    }
    counter=setTimeout("countDown()", 1000);
    }

    function startit(){
    if (document.all||document.getElementById)
    document.write('WEDDING DAY IN... <b id="countDownText">'+countDownTime+' </b> seconds')
    countDown()
    }

    if (document.all||document.getElementById)
    startit()
    else
    window.onload=startit
    setTimeout("location.href='http://www.wallpaperama.com'" , t)
    </script>

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,092
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Exclamation

    That is very old code.

    document.all only works in MSIE and has been deprecated in favor of document.getElementById
    and should be <script type="text/javascript"> rather than the <script> tag you currently have.

    You also need to show the HTML portion (or a link to the original code for us to fully help you.

    Finally, youl should post your code between [ code] and [ /code] tags (without the spaces)
    to make it easier for other forum members to read/analyze.

  • #3
    New Coder
    Join Date
    Jun 2011
    Location
    united kingdom
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    hi, thanks for the reply, any idea whee i can get a code for a countdown timer? as im not familiar with javascript.

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,092
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Question

    Quote Originally Posted by squish View Post
    hi, thanks for the reply, any idea whee i can get a code for a countdown timer? as im not familiar with javascript.
    Have you tried searching this forum
    or google with "javascript countdown timer"
    See: http://www.google.com/search?q=javas...ient=firefox-a

    Like: http://javascript.internet.com/time-...own-timer.html
    Or; http://forum.codecall.net/javascript...avascript.html
    Last edited by jmrker; 07-10-2011 at 05:10 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
    •