Results 1 to 4 of 4

Thread: Countdown to refresh page

  1. #1
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Countdown to refresh page

    Script: Refresh page Script
    http://dynamicdrive.com/dynamicindex6/refresh.htm

    Hi, This script is great but I was wondering how I would go about getting it to display the minutes and seconds? So, instead of saying 110 seconds it would say 1 minute 50 seconds. I tried playing with it myself but ended up breaking the script.. many times Any help would be really appreciated!

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+(countDownTime / 60)+' <span style="font-weight:normal;">minutes and</span> '+(countDownTime % 60)+'</b> seconds')
    Code:
    document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+(countDownTime / 60)+' <span style="font-weight:normal;">minutes and</span> '+(countDownTime % 60)+'</b> seconds')
    That ought to do it.
    This script needs rewriting, methinks.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help. Unfortunately that didn't seem to work.. it doesn't even show the "minutes and" text.. still only the seconds.

  4. #4
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I figured it out! Thanks for your help anyway Twey. Incase anybody needs this later on:

    I changed:
    Code:
    document.all.countDownText.innerText = countDownTime+" ";
    else if (document.getElementById) //else if NS6+
    document.getElementById("countDownText").innerHTML=countDownTime+" "
    to
    Code:
    document.all.countDownText.innerText = Math.floor(countDownTime / 60)+" minutes and "+(countDownTime % 60)+" ";
    else if (document.getElementById) //else if NS6+
    document.getElementById("countDownText").innerHTML= Math.floor(countDownTime / 60)+" minutes and "+(countDownTime % 60)+" "

Bookmarks

Posting Permissions

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