Today suddenly have a need to use, using JS code to change the selection of the Radio box. And I didn't want to go straight
Copy Code code as follows:
function Dogender (gender) {
if (gender = = "Male") {
Gel ("Radionan"). style.checked = "Checked";
} else {
Gel ("Radionv"). style.checked = "Checked";
}
}
function Gel (ID) {
return document.getElementById (ID);
}
One execution, no response ...
Because we set the check in the radio tag to be checked= "checked", so subconsciously to gel ("Radionv"). Style.checked assigned to "checked", and then the Internet to check
Originally in the JS code to select the Radio box to give checked value to true.
Continue to read:
Copy Code code as follows:
function Dogender (gender) {
if (gender = = "Male") {
Gel ("Radionan"). Style.checked = true;
} else {
Gel ("Radionv"). Style.checked = true;
}
}
One implementation, or no response, a little bit of a mask ... What's wrong????
Isn't it a style attribute????
Direct Gel ("Radionan") to click, you can see the checked property.
That's right,!!!!!.
Copy Code code as follows:
function Dogender (gender) {
if (gender = = "Male") {
Gel ("Radionan"). Checked = true;
} else {
Gel ("Radionv"). Checked = true;
}
}
As a matter of execution, it is true that ...
It's all over!!!!!!!!!!!!