Jump to content

Search the Community

Showing results for tags 'count up'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. Hi, I am new to html and css but I learned a thing or two through the tutorials. I am trying create a timer that indicates the last update of a post. So, the timer should count from 0 and stop when ever I update a new post. And, then, start the count again from 0. I was able to formulate one with the help of the tutorials, but I can't make it the way that I wanted. Instead, the timer automatically restarts when I refresh the page. Here's what I've made. I am not sure about the minutes and hours. <p id="p1">Last update: <label id="hours">00</label>:<label id="minutes">00</label>:<label id="seconds">00</label> <script type="text/javascript"> var hoursLabel = document.getElementById("hours"); var minutesLabel = document.getElementById("minutes"); var secondsLabel = document.getElementById("seconds"); var totalSeconds = 0; setInterval(setTime, 1000); function setTime() { ++totalSeconds; secondsLabel.innerHTML = pad(totalSeconds%60); minutesLabel.innerHTML = pad(parseInt(totalSeconds/60)); ++totalMinutes; minutesLabel.innerHTML = pad(totalMinutes%60); hoursLabel.innerHTML = pad(parseInt(totalMinutes/60)); ++totalHours; hoursLabel.innerHTML = pad(totalHours%24); hoursLabel.innerHTML = pad(parseInt(totalMinutes/60)); } function pad(val) { var valString = val + ""; if(valString.length < 2) { return "0" + valString; } else { return valString; } } </script></p> Could anyone help me out with how to make this not restart whenever the page is refreshed? I would really appreciate your help. Thanks.
×
×
  • Create New...