例子:单选按钮确定提交是否可用

<div style="width:500px; height:500px;">
 <div style="margin-top:20px;">
     <input type="radio" name="sure" id="s1" onclick="KeYong()" />同意
        <input type="radio" name="sure" id="s2" onclick="BuKeYong()" />不同意
    </div>
    <div style="margin-top:30px">
     <input type="submit" value="确定" id="btn" style="width:100px; height:35px;" disabled="disabled" />
    </div>
</div>

 

<script type="text/javascript">
   function KeYong()
 {
    //找到按钮
    var a = document.getElementById("btn");
  
    //操作按钮属性
    a.removeAttribute("disabled");
 }
   function BuKeYong()
 {
    var a = document.getElementById("btn");
    a.setAttribute("disabled","disabled");
 }
</script>

posted @ 2016-09-26 14:07  带你疯  阅读(193)  评论(0编辑  收藏  举报