Click to See Complete Forum and Search --> : Hi, Counter type question.


bkwoodroff
04-21-2003, 04:32 PM
i only know basic javascript so i'm not sure if this is possible...

can i write a function that when a user clicks a link, it adds 1 to a stored variable, basically a counter. But the link goes to only an image, not a page, and i want to be able to display the current total.

Its a download counter for wallpapers/backgrounds.
you click the size and it adds to the total for that background, which is displayed on the site...

if you can understand that (i can be confusing sometimes) can someone please either explain to me how, or maybe even write it *coughcough* :D I'd be very grateful!!!

Thanks

pyro
04-21-2003, 05:03 PM
Since javascript can not write to files on the server, you will need to use some sort of server side language (PHP, CGI/Perl, ASP, etc) to do this...

bkwoodroff
04-21-2003, 06:09 PM
thats what i thought, i can easily do it in php, its just that its a big resource hog on my server, aka my pc. so i don't use it. alright, thanks anyways.

DrDaMour
04-21-2003, 06:12 PM
now i'm not sure if this is STILL true, but counter suppliers used to let you have more than one counter if you put some special symbol at the end of your parameter, so what you COULD do, is

<a href="imagelocation" onclick="window.open('imagecounterURLwithSpecialCharacters','counter','')">


and use their server side stuff, you could then use those special counters to keep track of each download, also, you could even make that window, open in a frame, or open a new page that goes liek yoU ARE DOWLOAD #<img..

but this is the only way you could do it without server side code