Posted by Ed Jay on 12/16/05 20:27
When I run the below js, I get the error:
"document.form1.elements[menu_name+(i)].checked) is null or not an object"
<script type="text/javascript">
function get_menu_value(menu_name) {
var mValue = 0;
for(var i=0; i < menu_name.length; i++) {
if (document.form1.elements[menu_name+(i)].checked) {
mValue = mValue + document.form1.elements[menu_name+(i)].value;
}
}
alert(mValue);
return false;
}
</script>
<form name = "form1">
Choice (11)<input type=checkbox name=choice value=11><br>
Choice (13)<input type=checkbox name=choice value=13><br>
Choice (15)<input type=checkbox name=choice value=15><br>
Choice (19)<input type=checkbox name=choice value=19><br>
Choice (100)<input type=checkbox name=choice value=100><br>
<input type = "submit" onclick="get_menu_value('choice')">
</form>
--
Ed Jay (remove M to respond by email)
Navigation:
[Reply to this message]
|