标签:style blog http color os java io for ar
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(function(){ $("#form").submit(function(){//表单提交:复选框取值 var obj=$(‘input:checkbox[name="aaa"]:checked‘); alert("长度: "+obj.length); obj.each(function(){ var s=$(this).val(); alert(s); }); return false; }); }); </script> <form method="post" action="" id="form"> <input type="checkbox" name="aaa" value="1" checked> <input type="checkbox" name="aaa" value="2"> <input type="checkbox" name="aaa" value="3"> <input type="submit"> </form>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(function(){ $("#form").submit(function(){//表单提交:单选框取值 var aaa=$(‘input:radio[name="aaa"]:checked‘).val(); alert(aaa); return false; }); }); </script> <form method="post" action="" id="form"> <input type="radio" name="aaa" value="1" checked> <input type="radio" name="aaa" value="2"> <input type="radio" name="aaa" value="3"> <input type="submit"> </form>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(function(){ $("#check_all").click(function(){ var a=$(this)[0].checked; //alert( typeof a); var inputs = document.getElementsByTagName("input"); for(var i=0; i< inputs.length; i++){ if(inputs[i].type == "checkbox"){ inputs[i].checked = a; } } }); }); </script> <input type="checkbox" name="" id="check_all">选择所有 <hr> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br> <input type="checkbox" name=""><br>
标签:style blog http color os java io for ar
原文地址:http://www.cnblogs.com/qq21270/p/3941111.html