...

View Full Version : Javascript Counter



reynoldscorb
07-29-2010, 04:39 AM
Hey Everyone,

I'm working on a counter. I have two images - each with their own click count. Right now each time the page loads the counter goes back to zero. I would assume I need some kind of server side coding.

Any recommendations?

Here's what I have so far.

<html>
<head>
<script type="text/javascript">
var counter = 0;
function increaseloveit() {
counter += 1;
document.getElementById('loveit').value = counter;
}
var counter = 0;
function increasehateit() {
counter += 1;
document.getElementById('hateit').value = counter;
}
</script>
</head>
<body>

<form>
<a href="#" onclick="javascript:increaseloveit();"><input type="button" value="Love It!" name="loveit" onclick="" /></a><input id="loveit" value="0" size="2" /></form>
<form>
<a href="#" onclick="javascript:increasehateit();"><input type="button" value="Hate It!" name="hateit" onclick="" /></a><input id="hateit" value="0" size="2" /></form>

</body>
</html>

Philip M
07-29-2010, 07:36 AM
http://www.codingforums.com/showthread.php?p=976677#post976677


What part of that did you not understand? One more time, you will need server-side scripting and a database.

"It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt." - Mark Twain, US humorist, novelist, short story author, & wit (1835 - 1910)

reynoldscorb
07-29-2010, 07:48 AM
I think you misunderstood my post. Thank you for the recommendation and help on my previous post. I am now looking into server side hosting like you recommended.

I am asking for recommendations as to where I can get started with server side scripting...

Philip M
07-29-2010, 07:49 PM
I think you misunderstood my post. Thank you for the recommendation and help on my previous post. I am now looking into server side hosting like you recommended.

I am asking for recommendations as to where I can get started with server side scripting...

Well, in that case post your question in one of the server-side forums, e.g. PHP. This is the JavaScript forum. And your thread title is "Javascript Counter".



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum