nielse63
09-12-2009, 09:04 PM
I'm about half way through this code, but I'm having trouble saving and recalling the data that I want saved. Right now I'm working on a function where the user clicks on either "Good" or "Bad" and the number next to each word displays the number of times that word has been clicked. I'm having trouble saving the number clicks that each word is getting so that when the page is reloaded, they aren't set back to zero. Here's what I have so far:
<script>
function add_to_goodcount1(){
var goodcount1=document.getElementById('goodcount1');
var cstore = document.getElementById('good_counter_score1');
cstore.value=parseInt(cstore.value)+1;
goodcount1.innerHTML=cstore.value;
}
function add_to_badcount1(){
var badcount1=document.getElementById('badcount1');
var cstore = document.getElementById('bad_counter_score1');
cstore.value=parseInt(cstore.value)+1;
badcount1.innerHTML=cstore.value;
}
</script>
<a href="javascript:add_to_goodcount1();">Good </a><input type="hidden" name="good_counter_score1" id="good_counter_score1" value='0'><span id="goodcount1">0</span>
<p> </p>
<a href="javascript:add_to_badcount1();">Bad </a><input type="hidden" name="bad_counter_score1" id="bad_counter_score1" value='0'><span id="badcount1">0</span>
Any help on how to save this on the server would be very much appreciated. I'm really new to all this, so if you could possibly provide an example of how it should be written I'd appreciate it.
Thanks!
<script>
function add_to_goodcount1(){
var goodcount1=document.getElementById('goodcount1');
var cstore = document.getElementById('good_counter_score1');
cstore.value=parseInt(cstore.value)+1;
goodcount1.innerHTML=cstore.value;
}
function add_to_badcount1(){
var badcount1=document.getElementById('badcount1');
var cstore = document.getElementById('bad_counter_score1');
cstore.value=parseInt(cstore.value)+1;
badcount1.innerHTML=cstore.value;
}
</script>
<a href="javascript:add_to_goodcount1();">Good </a><input type="hidden" name="good_counter_score1" id="good_counter_score1" value='0'><span id="goodcount1">0</span>
<p> </p>
<a href="javascript:add_to_badcount1();">Bad </a><input type="hidden" name="bad_counter_score1" id="bad_counter_score1" value='0'><span id="badcount1">0</span>
Any help on how to save this on the server would be very much appreciated. I'm really new to all this, so if you could possibly provide an example of how it should be written I'd appreciate it.
Thanks!