|
|
<span style="font-family: Verdana, Tahoma, sans-serif; line-height: 22px;">good example
<span style=""><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; width: 661px; float: left; margin: 0px;"><div style="padding: 0px; margin: 0px;" class="post">jquery check全选/取消全选
<div style="padding-top: 5px; padding-right: 2px; padding-bottom: 5px; padding-left: 5px; line-height: 1.5em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dddddd; font-size: 14px; margin: 0px;" class="postBody"><HTML>
<HEAD>
<script type="text/javascript" src="jquery.js"></script>
<SCRIPT type="text/javascript">$(document).ready(function() {
$("#checkedAll").click(function(){
if($(this).attr("checked") == true){ //check all
$("input[@name='checkbox_name[]']").each(function(){
$(this).attr("checked",true);
});
}else{
$("input[@name='checkbox_name[]']").each(function(){
$(this).attr("checked",false);
});
}
});
});
</SCRIPT>
</HEAD>
<BODY>
<div class="components-list">
<input type="checkbox" name="checkbox_name[]" id="checkbox_name_1" />1<br />
<input type="checkbox" name="checkbox_name[]" id="checkbox_name_2" />2<br />
<input type="checkbox" name="checkbox_name[]" id="checkbox_name_3" />3<br />
<input type="checkbox" name="checkbox_name[]" id="checkbox_name_4" />4<br />
<input type="checkbox" name="checkedAll" id="checkedAll"/>全选/取消全选
</div>
<select id="test">
<option value="a">A</option>
<option value="b">B</option>
<option value="c" selected>C</option>
</select>
</BODY></HTML>
<div style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding: 0px;"><div style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 2em; float: left; width: 200px; color: #000000; font-size: 12px; padding: 0px;"><div style="float: left; line-height: 18px; padding: 0px; margin: 0px;" class="author_profile_info"><div style="float: left; line-height: 18px; padding: 0px; margin: 0px;" class="author_profile_info">闫磊博客
关注 - 0
粉丝 - 0 |
|