Skip navigation
Currently Being Moderated

I have this 24 hour countdown javascript but I need to remove something from it and I don't know how

Jun 21, 2011 4:22 PM

I found this javascript that is perfect for what I want but it displays the actual date on top of the countdown. Can any one help me to remove this date or hide it some how?

 

Thanks

 

 

<head>
<script type="text/javascript">
function ShowTimes() {
var now = new Date();
  var hrs = 23-now.getHours();
  var mins = 59-now.getMinutes();
  var secs = 59-now.getSeconds();
  var str = '';
     str =    now.toString();
      str += '<br>0 days '+hrs+' hours '+mins+' minutes '+secs+' seconds';
  document.getElementById('countdownToMidnight').innerHTML = str;
}
/*var _cntDown;
function StopTimes() {
    clearInterval(_cntDown);
}*/

 

</script>
</head>

 

<body onload="_cntDown=setInterval('ShowTimes()',1000)">
<div id="countdownToMidnight"></div>
<!--<button onclick="StopTimes()">Stop</button>-->
</body>

 
Replies
  • Currently Being Moderated
    Jul 26, 2011 3:23 PM   in reply to pchinique

    here you go

     

    <script type="text/javascript">
    function ShowTimes() {
    var now = new Date();
      var hrs = 23-now.getHours();
      var mins = 59-now.getMinutes();
      var secs = 59-now.getSeconds();
      var str = '';
         str =    now.toString();
          str = '0 days '+hrs+' hours '+mins+' minutes '+secs+' seconds';
      document.getElementById('countdownToMidnight').innerHTML = str;
    }
    /*var _cntDown;
    function StopTimes() {
        clearInterval(_cntDown);
    }*/

     

     

     

    </script>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points