What I want is to store the sum for a database object with id 3. (see input tags below) I have many different id's with different values. The value in the sample below I want to store is 2.
Besides that I want to increase/decrease the value of sum[3] using a "+" and a "-" button with JavaScript. So I created a function called incr and decr to do that:
<script type="text/javascript">
function incr(what)
{
alert(what);
what.value ++;
// rest of the function I left out, it works with a 'normal' name of the input tag
//but I need to use the array
}
</script>
how many?<input type="text" size="10" name="sum[3]" value="2" />
<input name="plus" type="button" value="+" onclick="incr(document.sum[3])" />
<input name="min" type="button" value="-" onclick="decr(document.sum[3])" />
I can't get it working, even the alert doesn't return a value. Anybody?