Ext Core实现Checkbox的全选
来源:互联网 发布:淘宝上有哪些促销活动 编辑:程序博客网 时间:2024/05/18 09:10
全选/不选在很多时候我们都会使用到,在Ext Core出来之前,我一直使用纯javascript写的全选,反选.虽然可以实现,但代码始终还是不够简洁.现在我们使用Ext Core,简单的几句代码就可以实现这一个功能.
实现方法如下:
1,新建一个 check_all_none.html.
全选/不选在很多时候我们都会使用到,在Ext Core出来之前,我一直使用纯javascript写的全选,反选.虽然可以实现,但代码始终还是不够简洁.现在我们使用Ext Core,简单的几句代码就可以实现这一个功能.
实现方法如下:
1,新建一个 check_all_none.html.
01.
<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
02.
<html>
03.
<head>
04.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
05.
<title>选中列表中的所有Checkbox</title>
06.
<script type=
"text/javascript"
src=
"../../ext-core-debug.js"
></script>
07.
<script type=
"text/javascript"
src=
"check_all_none.js"
></script>
08.
<link rel=
"stylesheet"
href=
"check_all_none.css"
/>
09.
</head>
10.
<body>
11.
<table id=
"fun"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"1"
>
12.
<tr id=
"header"
>
13.
<td width=
"25"
><input type=
"checkbox"
id=
"checkall"
name=
"checkall"
></td>
14.
<td>Name</td>
15.
</tr>
16.
<tr>
17.
<td>
18.
<input type=
"checkbox"
value=
"1"
id=
"funcode[]"
name=
"funcode[]"
></td>
19.
<td>ExtCore 1</td>
20.
</tr>
21.
<tr>
22.
<td>
23.
<input type=
"checkbox"
value=
"2"
id=
"funcode[]"
name=
"funcode[]"
></td>
24.
<td>ExtCore 2</td>
25.
</tr>
26.
<tr>
27.
<td>
28.
<input type=
"checkbox"
value=
"3"
id=
"funcode[]"
name=
"funcode[]"
></td>
29.
<td>ExtCore 3</td>
30.
</tr>
31.
<tr>
32.
<td>
33.
<input type=
"checkbox"
value=
"4"
id=
"funcode[]"
name=
"funcode[]"
></td>
34.
<td>ExtCore 4</td>
35.
</tr>
36.
<tr>
37.
<td>
38.
<input type=
"checkbox"
value=
"5"
id=
"funcode[]"
name=
"funcode[]"
></td>
39.
<td>ExtCore 5</td>
40.
</tr>
41.
<tr>
42.
<td>
43.
<input type=
"checkbox"
value=
"6"
id=
"funcode[]"
name=
"funcode[]"
></td>
44.
<td>ExtCore 6</td>
45.
</tr>
46.
<tr>
47.
<td>
48.
<input type=
"checkbox"
value=
"7"
id=
"funcode[]"
name=
"funcode[]"
></td>
49.
<td>ExtCore 7</td>
50.
</tr>
51.
<tr>
52.
<td>
53.
<input type=
"checkbox"
value=
"8"
id=
"funcode[]"
name=
"funcode[]"
></td>
54.
<td>ExtCore 8</td>
55.
</tr>
56.
<tr>
57.
<td>
58.
<input type=
"checkbox"
value=
"9"
id=
"funcode[]"
name=
"funcode[]"
></td>
59.
<td>ExtCore 9</td>
60.
</tr>
61.
</tbody>
62.
</table>
63.
<p style=
"text-align:center; font-size:18px;"
>© 2010 <a href=
"http://extjs.org.cn"
target=
"_blank"
>ExtJs.org.cn</a> | <script type=
"text/javascript"
>eval(unescape(
'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%65%78%74%6a%73%63%6e%40%31%32%36%2e%63%6f%6d%22%3e%65%78%74%6a%73%63%6e%40%31%32%36%2e%63%6f%6d%3c%2f%61%3e%27%29%3b'
))</script><a href=
"mailto:extjscn@126.com"
>extjscn@126.com</a> </p>
64.
</body>
65.
</html>
01.
Ext.onReady(
function
(){
02.
Ext.get(
'checkall'
).on(
'click'
,
function
(){
03.
if
(
this
.dom.checked){
04.
Ext.select(
'input[name^=funcode]'
).each(
function
(){
this
.dom.checked =
true
;});
05.
}
else
{
06.
Ext.select(
'input[name^=funcode]'
).each(
function
(){
this
.dom.checked =
false
;});
07.
}
08.
});
09.
});
- Ext Core实现Checkbox的全选
- Ext Core实现Checkbox的全选
- CheckBox全选的实现
- JS的checkbox实现全选
- Javascript实现CheckBox的全选与取消全选的代码
- Javascript实现CheckBox的全选与取消全选的代码
- Javascript实现CheckBox的全选与取消全选的代码
- 实现列表CheckBox全选的Javascript
- 如何实现checkbox的全选/取消
- checkbox实现全选的多种方法
- GridView中如何实现CheckBox的全选?
- GridView中实现CheckBox的全选
- GridView中实现CheckBox的全选
- GridView中实现CheckBox的全选
- GridView中实现CheckBox的全选
- CheckBox全选功能的实现--JavaScript
- checkBox 全选框的 jQuery实现
- checkbox实现全选的多种方法
- <谷歌如何测试> 翻译第四篇
- MySQL配置文件笔记
- C++命名空间的解释
- 新的开始
- <谷歌如何测试> 翻译第五篇
- Ext Core实现Checkbox的全选
- 最好的医生是自己
- <谷歌如何测试> 翻译第六篇
- 如何将man与info文档转换为文本方式+info阅读
- VMware虚拟机上网问题
- Facebook 的自动化测试
- Spring学习笔记 初始化属性为null值的方法
- 一个程序员的时间管理
- 当前不会命中断点 还没有为该文档加载任何符号