Using the DOM and radio buttons
Since they share a name, the values of a group of radio buttons can be collected in an array-like objectAn object that has some, but not all, of the functionality of an array. using the method getElementsByName
.
For each entry, the value attributeExtra information added to an element. can be accessed as the value
property of the node object, and the checked
property will be true for the button which has been checked.
Note:
Hints:
- undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX