reynoldscorb
07-27-2010, 07:48 AM
Hey Everyone,
I'm trying to set up two different buttons that count their own individual clicks.
So far I have everything except where one button leaves off, the other picks up. So if I click the left one three times it shows the number 3, and then if I click the button next to it, that button picks up at 4. I want each button to have its own count.
Any ideas?
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 trying to set up two different buttons that count their own individual clicks.
So far I have everything except where one button leaves off, the other picks up. So if I click the left one three times it shows the number 3, and then if I click the button next to it, that button picks up at 4. I want each button to have its own count.
Any ideas?
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>