Home >Web Front-end >HTML Tutorial >When the name of the radio button button is a number, the status of the button cannot be obtained. The code _html/css_WEB-ITnose is attached.
alert(document.form1.1.checked);
The above sentence is wrong , cannot get whether the button is selected
Only when the name is not an array, is there any solution, because the buttons are dynamically generated, and the names are all numbers
name =s1 The combination of letters and numbers will not work==
It is not possible to set it to 1, but s1 is OK. Did you get it after loading?
Why do you have to use name? Give it an ID
js======
alert(document.getElementById('abc').checked);
alert(document.getElementsByName('1')[0 ].checked)