Home >Web Front-end >JS Tutorial >Select the checkbox button to be grayed out otherwise the button is available_javascript skills
<html> <br><head> <br><script> <br>function asd(){ <br>var reg=document.getElementsByName("reg"); <br>if(reg[0].checked){ <br>document.getElementById("submit").disabled=false; <br>} <br>else { <br>document.getElementById("submit").disabled=true; <br><br>} <br>} <br></script> <br><br></head> <br><body> <br><input name="reg" type="checkbox" onclick="asd();" />阅读了吗? <br><input type="submit" value="注册" id="submit" disabled/> <br></body> <br></html>