复选框控制按钮可用不可用
<script type="text/javascript"> function changeButton(){ if($("#contract").is(":checked")==true){ $("#btsubmit").removeAttr("disabled"); }else{ $("#btsubmit").attr({"disabled":"disabled"}); } } </script> <body> <form action="contract" method="post"> <textarea rows="8" cols="10">contract content</textarea><br> <input type="checkbox" name="contract" id="contract" onchange="changeButton()"><br> <input type="submit" name="submit" id="btsubmit" disabled> </form> </body>
时间: 2024-10-22 21:39:30