Hi, i have a problem passing a form element name through a function to act upon it. I dont know why it is not working.
The problem is that the function isn't picking up the form element that is being passed through.
The PHP outputs the correct name
any ideas on how to make it work?
Regards,
Martin
Computing Design And Services:
The problem is that the function isn't picking up the form element that is being passed through.
The PHP outputs the correct name
Code:
<input type="checkbox" name="group1_<?php echo $name; ?>" value="<?php echo $pts; ?>" onclick="javascript:addPoints('group1_<?php echo $name; ?>', 'group1total',this.value);" />
Code:
function addPoints([COLOR=red]cb[/color], gr, pts){
var curPts = parseInt(document.getElementById(gr).innerHTML);
var cbname = document.memlist.cb;
alert(cbname);
// see if checkbox is checked or not for addition / subtraction
if(document.memlist.[COLOR=red]cb[/color].checked == true){
alert("yh");
var newTot = curPts + parseInt(pts);
}else{
alert("na");
var newTot = curPts - parseInt(pts);
}
document.getElementById("group1total").innerHTML = newTot;
}
Regards,
Martin
Computing Design And Services: