I am fairly new to all of this but I think it's great! I've taken courses in HTML, JavaScript and currrently CGI Programming.

My question: Is there an easy way to make a counter in JavaScript? Seems like there should be but can't quite figure it out.

Thank you, :-|

Recommended Answers

All 4 Replies

Please define "counter". In programming terms, a counter is simple a variable that is incremented, perhaps within a loop. Yes, JavaScript can do that.

Yes I would like to keep track of how many visitors to the site.

Thank you,

JavaScript cannot do that. It has no way to read/write info to the server, since it's a client-side language. You'll need a server-side program to implement a "hit counter".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.