| Quote: |
|
can any one tell me simple javascript code for counting hits of the page i know javascript i have just written a function that takes valu and returns it by incrementing but i dont know how to call that function as soon as page loads? please ,if any one can write code it will be better for me |
counter help
| Code: |
| <body onLoad="yourFunctionName()"> |
You can't make a counter in javascript. Everything in javascript is executed in the browser, so the browser can only know how much it visited your page itself, not how much other computers visited the page.
To do this, you'll need something like a PHP hit counter. They're fairly simple to write. You can make it only count unique hits (as in unique IPs) or global hits (all hits, including duplicate IPs).
your counter in javascript if home made will not work but if you use php using php math and file_get_contents() and file_put_contents().
To maintain live counter you have to required PHP or other server side script to store data. if you can not do this then you should go with this, pre made counter will help you mich better and give each and every information about visitors.
http://cqcounter.com/?_id=ritesh26&_lo=in2
http://cqcounter.com/?_id=ritesh26&_lo=in2
there are quite some few, try searching a little but javascripts would use cookies which means it wont count your site visit. think again.
