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>
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>