Datatrend Software - Digitizing software and CGI Scripts

DataTrend Software
CGI Scripts


AutoContact
AutoFollowUp
AutoMail
AutoMail Lite
Bookkeeper Lite
CountDown
CountDown Lite
CountLink
Script Feedback


PERL/CGI Books

 How to add a javascript counter to your site
CountDown can create a log file called "countdown.js" that can be used to place counters on your webpages to show the number of downloads of a particular file.
The format of the countdown.js file is:

Name1 = 10
Name2 = 13
etc...

Steps to display a counter on your site.

1. Between the head tags of any HTML page, add a file reference as below. This defines the counter file for the javascripts. You must replace the "src" variable with the URl of your log file.

<head>
<script src ="http://www.yoursite.com/cgi-bin/countdown.js"></script>
</head>

2. To display the counts on your page, insert the following HTML. Change "Name1" to whatever your filename actually is in the log.

<script>document.write("<b>" + Name1 + "</b>")</script>


Warning - Things that won't work
The following characters in your names will cause errors. You must use the RealNames feature of CountDown3 to format the names properly.
1. Names with periods, like Name1.exe, will not work, use RealNames to rename it as Name1.
2. Numbers at the start of the name, like 1Name will not work, Name1 will.
3. Dashes don't work. Name-1 will not work, Name_1 will.
If you have an error, you must reset the countdown.log file to make sure that the next time the javascript log file is created it does not repopulate the file with the incorrect logs from the main ".log" file.


EXAMPLE:
The countdown.js file on this site contains:
javatestname = 1245

This HTML will create a javascript counter
------
<html>
<head>
<title>
</title>
<script src ="http://www.datatrendsoftware.com/countdown.js">
</script>
</head>
<body>The file JavaTestName has been downloaded <script>document.write("<b>" + javatestname + "</b>")</script> times.
</body>
</html>
------

Output

This is an actual javascript counter. The number was generated from the countdown.js file using the code above.
------
The file JavaTestName has been downloaded times.
------

AutoContact|AutoMail|Bookkeeper|CountDown|CountLink|
Script Home|Script Feedback


Send mail to info@datatrendsoftware.com with questions about this web site or our products.
Copyright © Datatrend Software.
PO Box 80471, Raleigh, NC USA 27623.
800-536-6951 toll free fax