jquery实现全选,反选,不选和提交按钮
来源:互联网 发布:java shell 交互 编辑:程序博客网 时间:2024/05/06 08:05
我的一个php文件:
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="check.js"></script>
</head>
<body>
<form action="" method="get" id="myFrom">
<input type="checkbox" name="checkbox" value="1">checkbox1<br/>
<input type="checkbox" name="checkbox" value="2">checkbox2<br/>
<input type="checkbox" name="checkbox" value="3">checkbox3<br/>
<input type="checkbox" name="checkbox" value="4">checkbox4<br/>
<input type="checkbox" name="checkbox" value="5">checkbox5<br/>
<input type="checkbox" name="checkbox" value="6">checkbox6<br/>
选择:<a id="quanxuan" href="#">全选</a> <a id="fanxuan" href="#">反选</a> <a id="buxuan" href="#">不选</a><br/>
<input type="button" value="提交" id="submit">
</form>
</body>
</html>
我的check.js文件
$(document).ready(function(){
$('#myFrom').find("#quanxuan").bind("click",quanxuan);
$('#myFrom').find("#fanxuan").bind("click",fanxuan);
$('#myFrom').find("#buxuan").bind("click",buxuan);
$("#myFrom").find("#submit").bind("click",submit);
});
function quanxuan(){
$('#myFrom').find("[name='checkbox']").attr("checked",true);
}
function fanxuan(){
$('#myFrom').find("[name='checkbox']").each(function(){
if($(this).attr("checked")){
$(this).removeAttr("checked");
}else{
$(this).attr("checked",true);
}
});
}
function buxuan(){
$('#myFrom').find("[name='checkbox']").each(function(){
if($(this).attr("checked")){
$(this).removeAttr("checked");
}
});
}
function submit(){
var str="";
$('#myFrom').find("[name='checkbox']").each(function(){
if($(this).attr("checked")){
str+=$(this).val()+" "
}
});
alert(str);
}
- jquery实现全选,反选,不选和提交按钮
- jQuery实现的全选、反选和不选功能
- jQuery实现的全选、反选和不选功能
- jQuery实现的全选、反选和不选功能
- jQuery实现的全选、反选和不选功能
- jQuery实现的全选、反选和不…
- jquery实现全选,反选,不选
- jQuery实现checkbox全选和反选
- jquery和js实现全选反选
- jquery实现 checkbox全选和反选
- jQuery实现全选全不选和反选
- JQuery实现全选和反选
- 使用JQuery实现全选和反选
- Jquery实现checkbox全选和反选
- JQuery 实现全选和反选
- Jquery 实现全选和反选
- jquery实现全选和反选
- jquery实现全选和反选
- UCOS下邮箱使用 2010.6.6
- Spring bean 的继承与Java 中继承的区别
- Firefox extension开发实战
- java 使用javamail发送邮件
- C# ref与out区别
- jquery实现全选,反选,不选和提交按钮
- CorelDRAW 编写和运行宏指令
- 向servlet发送xml的一个例子
- Ubuntu下获得root权限和设置静态IP
- wav音频文件
- Win32下免安装版的MySQL配置方法
- IBatis简单实现(附主键自动生成)其SqlMap XML文件配置
- codeblocks(IDE/C++集成编辑环境最新汉化版)
- Ubuntu freemind 中文乱码解决方案