`
- 浏览:
162138 次
- 性别:
- 来自:
武汉
-
-
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
-
<html xmlns="http://www.w3.org/1999/xhtml"
>
-
<head>
-
<meta http-equiv="Content-Type"
content=
"text/html; charset=gb2312"
/>
-
<title>louis-blog >> jQuery 对checkbox的操作</title>
-
<script type='text/javascript'
src=
"../jquery.js"
></script>
-
<SCRIPT LANGUAGE="JavaScript"
>
-
<!--
-
$("document"
).ready(function(){
-
$("#btn1"
).click(function(){
-
$("[name='checkbox']"
).attr(
"checked"
,
'true'
);
-
})
-
$("#btn2"
).click(function(){
-
$("[name='checkbox']"
).removeAttr(
"checked"
);
-
})
-
$("#btn3"
).click(function(){
-
$("[name='checkbox']:even"
).attr(
"checked"
,
'true'
);
-
})
-
$("#btn4"
).click(function(){
-
$("[name='checkbox']"
).each(function(){
-
if
($(
this
).attr(
"checked"
)){
-
$(this
).removeAttr(
"checked"
);
-
}
-
else
{
-
$(this
).attr(
"checked"
,
'true'
);
-
}
-
})
-
})
-
$("#btn5"
).click(function(){
-
var str=""
;
-
$("[name='checkbox'][checked]"
).each(function(){
-
str+=$(this
).val()+
"\r\n"
;
-
-
})
-
alert(str);
-
})
-
})
-
-->
-
</SCRIPT>
-
</HEAD>
-
<body style="text-align:center;margin: 0 auto;font-size: 12px;"
>
-
<div style="border: 1px solid #999; width: 500px; padding: 15px; background: #eee; margin-top: 150px;"
>
-
<form name="form1"
method=
"post"
action=
""
>
-
<input type="button"
id=
"btn1"
value=
"全选"
>
-
<input type="button"
id=
"btn2"
value=
"取消全选"
>
-
<input type="button"
id=
"btn3"
value=
"选中所有奇数"
>
-
<input type="button"
id=
"btn4"
value=
"反选"
>
-
<input type="button"
id=
"btn5"
value=
"获得选中的所有值"
>
-
<br><br>
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox1"
>
-
checkbox1
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox2"
>
-
checkbox2
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox3"
>
-
checkbox3
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox4"
>
-
checkbox4
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox5"
>
-
checkbox5
-
<input type="checkbox"
name=
"checkbox"
value=
"checkbox6"
>
-
checkbox6
-
</form>
-
</div>
-
</body>
-
</HTML>
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
jquery checkbox 选中 取消 checkbox多选
jQuery Checkbox列表双向选择移动代码,通过点击左右箭头按钮可以分别将两边div块中复选框已选中的列表项目在两边来回移动。
自动动手写了个操作checkbox,里面包括全选、全不选、反选、获取选中值四个功能...
jquery Checkbox 全选 反选 全不选 多种实现方法 和表单验证
jquery checkbox点击选中列表样式代码
基于jQuery的Checkbox精美样式插件 .
JQuery操作checkbox、radio等示例
jQuery的高性能TreeView源码(带CheckBox) 1:支持静态的树,即一次性将全部数据加载到客户端。 2:异步树,即一次只加载一级或若干级节点,子节点可以异步加载数据。 3:Checkbox树(可能是静态树也可能是异步树...
用Jquery 实现的可动态更改树节点值的 checkbox tree.
仅供学习,有兴趣可以看看,高手勿入。代码很简单的。
jquery 树形 checkbox jQuery(document).ready(function(){ jQuery(".mytree").checkboxTree({ collapsedarrow: "images/checkboxtree/img-arrow-collapsed.gif", expandedarrow: "images/checkboxtree/img-...
绚丽的复选框 jquery-checkbox 具体参见http://blog.csdn.net/evangel_z/article/details/8259200
jquery动态生成checkbox 设置一行最多显示几个checkbox 获取checkbox选中项
C#.net下通jQuery实现的由CheckBox来控件CheckBoxList的全选操作,通过CheckBox来全选CheckBoxList,当有一个CheckBoxList选中时,CheckBox则被选中,且并且可以取得选中的CheckBox和CheckBoxList的value和text
有兴趣刚需的可以自己下载,非常实用的jquery代码,可以完美运行,有能力的还可以二次修改!
jquery实现checkbox全选、反选、全部选,很不错的资源,欢迎大家下载学习var langType=""; var arLangType = []; $("[name='langType'][checked]").each(function(i) { arLangType[i]=$(this).val(); }); ...
博文链接:https://qsfwy.iteye.com/blog/236001
代码如下: $(function(){ $(‘:checkbox[name=flag]’).each(function(){ $(this).click(function(){ if($(this).attr(‘checked’)){ $(‘:checkbox[name=flag]’).removeAttr(‘checked’); $(this).attr(...