I have a series of one line text buttons that have numbers in them and I want to sum up those numbers. The text input names are a1, a2, a3…… I was thinking of writing a javaScript function something like this:
<script type=”text/javascript”>
function add_values(length_of_list) {
var total=0.0;
for (var i=1; i<=length_of list; i++){
name=’a’+i;
total+= document.formname.name.value;
}
}
</script>
But…..this won’t work, at least the way I have it. The name in document.formname.[B]name
Can anyone tell me if what I’m trying to do is possible? Any help and/or suggestions will be greatly appreciated!
– Mike