复选框-checkbox单击全部选中
01
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
02
<html>...</html><html xmlns="http://www.w3.org/1999/xhtml">
03
04
<head>...</head><head>
05
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
06
<title>复选框-checkbox单击全部选中</title>
07
<script type="text/javascript">
08
function select(m){
09
var ids = document.getElementById(m).getElementsByTagName("input");
10
for(var i=0; i<ids.length;i++){
11
if(ids[i].checked == ""){
12
ids[i].checked="checked";
13
}else{
14
ids[i].checked="";
15
}
16
}
17
setTimeout(openwindows(),1000)
18
function openwindows(){
19
window.location.href="http://www.ui163.com";
20
}
21
}
22
</script>
23
<style type="text/css">
24
body{text-align:center;}
25
img{border:0; width:100px; height:40px;}
26
.focus{background-color:#f4f4f4; border:1px solid #5fbcff;}
27
.blur{background-color:#fff; border:1px solid #ccc;}
28
.on{border:1px solid #ccc;}
29
table{border:#ccc solid 1px;}
30
</style>
31
</head>
32
33
<body>...</body><body>
34
<!-- SiteSearch Google -->
35
<h1>为你的网站增加个性化定制的google搜索工具条</h1>
36
<form>...</form><form method="get" action="http://www.google.com/search">
37
<table cellpadding="0" cellspacing="0" border="0"><tr><td>
38
<a href="http://www.google.com/">
39
<img src="http://www.google.com/logos/Logo_40wht.gif" /></a>
40
</td>
41
<td>
42
<input type="text" class="on" name="q" size="18" value="设计学院" onfocus="javascript:this.value='';this.className='focus'" onblur="javascript:this.value='设计学院';this.className='blur'"/><input type="hidden" name="ie" value="GB2312"/><input type="hidden" name="oe" value="GB2312"/><input type="hidden" name="hl" value="zh-CN"/> <input type="submit" name="btnG" value="搜索"/>
43
<font size="-1">
44
<input type="hidden" name="domains" value="http://www.ui163.com"/><br/>
45
</font>
46
</td></tr></table>
47
</form>
48
<!-- SiteSearch Google -->
49
<form>...</form><form id="form1" name="form1">
50
<input type="checkbox" value="ssss" /><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/>
51
<a href="javascript:void(0)" onclick="select('form1')">aaaaaaaaaa</a>
52
</form>
53
54
</body>
55
56
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 02

<html>...</html><html xmlns="http://www.w3.org/1999/xhtml"> 03
04

<head>...</head><head> 05
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" /> 06
<title>复选框-checkbox单击全部选中</title> 07
<script type="text/javascript"> 08
function select(m){ 09
var ids = document.getElementById(m).getElementsByTagName("input"); 10
for(var i=0; i<ids.length;i++){ 11
if(ids[i].checked == ""){ 12
ids[i].checked="checked"; 13
}else{ 14
ids[i].checked=""; 15
} 16
} 17
setTimeout(openwindows(),1000) 18
function openwindows(){ 19
window.location.href="http://www.ui163.com"; 20
} 21
} 22
</script> 23
<style type="text/css"> 24
body{text-align:center;} 25
img{border:0; width:100px; height:40px;} 26
.focus{background-color:#f4f4f4; border:1px solid #5fbcff;} 27
.blur{background-color:#fff; border:1px solid #ccc;} 28
.on{border:1px solid #ccc;} 29
table{border:#ccc solid 1px;} 30
</style> 31
</head> 32
33

<body>...</body><body> 34
<!-- SiteSearch Google --> 35
<h1>为你的网站增加个性化定制的google搜索工具条</h1> 36

<form>...</form><form method="get" action="http://www.google.com/search"> 37
<table cellpadding="0" cellspacing="0" border="0"><tr><td> 38
<a href="http://www.google.com/"> 39
<img src="http://www.google.com/logos/Logo_40wht.gif" /></a> 40
</td> 41
<td> 42
<input type="text" class="on" name="q" size="18" value="设计学院" onfocus="javascript:this.value='';this.className='focus'" onblur="javascript:this.value='设计学院';this.className='blur'"/><input type="hidden" name="ie" value="GB2312"/><input type="hidden" name="oe" value="GB2312"/><input type="hidden" name="hl" value="zh-CN"/> <input type="submit" name="btnG" value="搜索"/> 43
<font size="-1"> 44
<input type="hidden" name="domains" value="http://www.ui163.com"/><br/> 45
</font> 46
</td></tr></table> 47
</form> 48
<!-- SiteSearch Google --> 49

<form>...</form><form id="form1" name="form1"> 50
<input type="checkbox" value="ssss" /><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/><input type="checkbox" value="ssss"/> 51
<a href="javascript:void(0)" onclick="select('form1')">aaaaaaaaaa</a> 52
</form> 53
54
</body> 55
56
</html>Source Code to Run
[Ctrl+A 全部选择进行拷贝 提示:可先修改部分代码,再点击运行]
[本日志由 ui163 于 2007-10-30 11:20:03 编辑]
上一篇:关于DOM事件模型的两件事
下一篇:获取鼠标坐标数值
文章来自:设计学院(原创)
收藏到网摘:
收藏到QQ书签
Tags:
上一篇:关于DOM事件模型的两件事
下一篇:获取鼠标坐标数值
文章来自:设计学院(原创)
收藏到网摘:
收藏到QQ书签
Tags:

