Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counters 1

Status
Not open for further replies.

Chris75

IS-IT--Management
Jan 31, 2001
19
US
New to designing/making web pages so I hope this doesn't sound too silly. Is there a way to make a counter that counts only days? We would like to be able to count days where there aren't any negative reports. When there is a report, we want to be able to reset the counter to zero. the reset doesn't need to be automatic, it can be done manually if that is easier. Any help would be great.
 
By days, I mean we want it count one click for each day. So at let's say midnight, we want a click to be added to the counter.
 
Try this:

Code:
<script>
<!-- Hide me Mommy --

var montharray=new Array(&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;,&quot;Oct&quot;,&quot;Nov&quot;,&quot;Dec&quot;)

function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+&quot; &quot;+todayd+&quot;, &quot;+todayy
var paststring=montharray[m-1]+&quot; &quot;+d+&quot;, &quot;+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=&quot; days&quot;
document.write(&quot;It\'s been &quot;+difference+&quot; since the launch of !&quot;)
}
// change the date below to be the date you want to count from
// using the format year/month/day
countup(2001,03,21)

-- Unhide me Mommy -->
</script>
» » » » » »
Mike Barone
FREE and Pro CGI/Perl Scripts

FREE Scripts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top