<script type="text/javascript">
function sub() {
alert("dfd");
if (document.vForm.after.checked) {
document.vForm.inputSubmit.disabled = disabled;
} else {
 document.vForm.inputSubmit.disabled=false; }
}
</script>

解决方案 »

  1.   


    <html>
    <head>
    <script type="text/javascript">
    function sub() 
    {
    if (document.getElementById("marry").checked) 
    {
    document.getElementById("marry").disabled = "";

    else
    {
    document.getElementById("marry").disabled = "disabled";
    }
    document.forms["myForm"].submit();
    }
    </script>
    </head>
    <body>
    <form action="abc.html" id="myForm">
    婚否:<input type="checkbox" id="marry" value="true"/>
    <input type="button" onclick="sub()"/>
    </form>
    </body>
    </html>
      

  2.   


    <script type="text/javascript">
    function show(){
    var ckk = document.getElementById("ck");
    if(ckk.checked){
    document.form1.bt.disabled = true;
    }else{
    document.form1.bt.disabled = false;
    }
    }
    </script>
    </head>
    <body>
    <form name=form1>
    <input type="checkbox" id="ck" onclick="show()">
    <input type="button" name="bt" value="xx   xx">
    </form>