The following questions use the following form element:
- 1 points: What javascript event handler should handle the pressing of a radio
button or checkbox button? onClick
- 4 points: Write a javascript function named enabler that takes as a parameter
a radio button object and enables/disables the appropriate checkboxes based on the value
of the button. For example, when the "veggie" button is pressed, the veggie items should
be enabled and the meat items should be disabled. Do not bother with clearing the checkboxes
when they are disabled.
function setter(meat_flag, veggie_flag) {
with (document.forms.pizza) {
sausage.disabled = meat_flag;
pepperoni.disabled = meat_flag;
ham.disabled = meat_flag;
onion.disabled = veggie_flag;
pepper.disabled = veggie_flag;
}
}
function enabler(button) {
if (button.value == "meat")
setter(false, true);
else
setter(true,false);
}