如题。JQUERY我不熟悉。最好完全按照JQUERY的方式。JS和HTML分开的形式。
解决方案 »
- 本地数据库经纬度 调用百度地图API 在百度地图上显示 用什么方案实现的问题。。
- 急求一份js日历源码
- <script>使用Java的数据
- 项目问题
- [原创] Fonshen Js MenuTree Version 1.00(无限级菜单树)发布
- 怎么样将另一个页网里的table的内容读取到数组
- 史上最牛逼聊天插件
- javascript 中 unonload事件痛苦的问题,请高手解决,急!!!
- javascript中如何判断一个字符串是中文还是英文??
- 麻烦各位了!
- 那位大虾知道哪个Jquery插件有实现类似QQ软件界面的隐藏和显示(当鼠标移过去就让窗口右边缘显示,反之就隐藏)
- eclipse 把鼠标移到某个类上弹出提示信息是怎么实现的
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/JScript.js" type="text/javascript"></script>
</head>
<body>
<table id="tab">
<tr>
<td>
<input type="checkbox" id="ssssss" />
</td>
<td>
<input type="checkbox" id="Checkbox1" />bbb
</td>
<td>
<input type="checkbox" id="Checkbox2" />cccc
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="Checkbox3" />
</td>
<td>
<input type="checkbox" id="Checkbox4" />eee
</td>
<td>
<input type="checkbox" id="Checkbox5" />ffff
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="Checkbox6" />
</td>
<td>
<input type="checkbox" id="Checkbox7" />hhhh
</td>
<td>
<input type="checkbox" id="Checkbox8" />jjjj
</td>
</tr>
</table>
</body>
</html>
<script>
$(function () {
//查找id=tab的表格,下面所有的tr,下面的所有td,第一个td下面复习框的点击事件。
$("#tab tr>td:nth-child(1)").find("input[type='checkbox']").bind("click", function () {
if ($(this).attr("checked") == true) {
$(this).parent().nextAll().find("input[type='checkbox']").attr("checked", true);
}
else {
$(this).parent().nextAll().find("input[type='checkbox']").attr("checked", false);
}
})
})
</script>
你写那么多,用的可不是jquery的思想啊其实一句话就能搞定的。就你的html代码,实现 本行全选与全不选。$(function(){
$("input[type=checkbox]").click(function(){ $(this).parent().parent().find("input[type=checkbox]").attr("checked",$(this).attr("checked"));
});
});
$(this).parent().parent(input[type=checkbox]).attr("checked",$(this).attr("checked"));
$("input[@name='shareuser']").each(function() {
$(this).attr("checked", true);
});
}); <input type='checkbox' id='in-shareuser-10' name='shareuser' value='10' />10
<input type='checkbox' id='in-shareuser-11' name='shareuser' value='11' />11
<input type='checkbox' id='in-shareuser-12' name='shareuser' value='12' />12
<input type="button" id="selectall" name="selectall" value="全选" />
思路就是给全选复选框一个点击事件,其他的复选框设为同一个class,点击后这个class选中。
全选复选框id='xx';其他复选框class='ss';$('#xx').click(function(){
$(‘.ss’).attr('checked', true);},function(){
$('.ss').attr('checked',false);})