<!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>无标题文档</title>
<script language=javascript>
function selectBox(selectType){
if (typeof selectType =="object")testselect()
if (typeof selectType =="string"){
var ws= selectType=='all'?1:0
setselect(ws)
testselect()
}
}
function testselect(){
var checkboxis = document.getElementsByName("checkbox");
var list = [];
for (var i=0; i<checkboxis.length; i++)
if (checkboxis[i].checked)
list[list.length] = checkboxis[i].value;
for (var j=0;j<list.length;j++){
alert( list[j]);
}
}function setselect(ws){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++)
checkboxis[i].checked = ws;
}onload=function(){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++){
checkboxis[i].onclick=function(){selectBox(this)}
}
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<table width="120" border="1">
<tr>
<td colspan="2">
<input type="button" name="all" value="全选" onclick="selectBox('all')"/>
<input type="button" name="reverse" value="取消" onclick="selectBox('reverse')"/>
</td>
</tr>
<tr>
<td colspan="2">
checkbox1<input type="checkbox" name="checkbox" value="checkbox1" />
</td>
</tr>
<tr>
<td width="110">
checkbox2<input type="checkbox" name="checkbox" value="checkbox2" />
</td>
</tr>
<tr>
<td colspan="2">
checkbox3<input name="checkbox" type="checkbox" id="checkbox" value="checkbox3" />
</td>
</tr>
</table>
</form></body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language=javascript>
function selectBox(selectType){
if (typeof selectType =="object")testselect()
if (typeof selectType =="string"){
var ws= selectType=='all'?1:0
setselect(ws)
testselect()
}
}
function testselect(){
var checkboxis = document.getElementsByName("checkbox");
var list = [];
for (var i=0; i<checkboxis.length; i++)
if (checkboxis[i].checked)
list[list.length] = checkboxis[i].value;
for (var j=0;j<list.length;j++){
alert( list[j]);
}
}function setselect(ws){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++)
checkboxis[i].checked = ws;
}onload=function(){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++){
checkboxis[i].onclick=function(){selectBox(this)}
}
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<table width="120" border="1">
<tr>
<td colspan="2">
<input type="button" name="all" value="全选" onclick="selectBox('all')"/>
<input type="button" name="reverse" value="取消" onclick="selectBox('reverse')"/>
</td>
</tr>
<tr>
<td colspan="2">
checkbox1<input type="checkbox" name="checkbox" value="checkbox1" />
</td>
</tr>
<tr>
<td width="110">
checkbox2<input type="checkbox" name="checkbox" value="checkbox2" />
</td>
</tr>
<tr>
<td colspan="2">
checkbox3<input name="checkbox" type="checkbox" id="checkbox" value="checkbox3" />
</td>
</tr>
</table>
</form></body>
</html>
解决方案 »
- 传值,刷新页面
- 如何获取www.123-cha.com/article/123.htm这个URL中的123这个数字
- 怎么判断显示在List中的数据,大于30个字符显示两行,大于60个字符的话后面的全都不要了
- 禁用上下左右键
- 关于JS存在数据库问题 再线等待
- 正则表达"var reg =/(\@[^\@]*){10}$/g; "中,如果其中的10是一个变量怎么办?直接将10写成变量不好用的。
- 有没有比较好的方法生成select的option
- 我出200分---请各位高手帮忙把这段代码升个级 另外100分就在附近
- 怎么实现着功能
- 那里有IE和Netscape之间区别的手册或文章!
- js判断 多选下拉列表 所选择的数量
- [高分100]javascript在IE6.0下的一个简单问题,字符替换的问题,在线等
<!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>无标题文档</title>
<script language=javascript>
function selectBox(selectType){
if (typeof selectType =="object")testselect()
if (typeof selectType =="string"){
var ws= selectType=='all'?1:0
setselect(ws)
testselect()
}
}
function testselect(){
var checkboxis = document.getElementsByName("checkbox");
var list = [];
for (var i=0; i<checkboxis.length; i++)
if (checkboxis[i].checked)
list[list.length] = checkboxis[i].value;
for (var j=0;j<list.length;j++){
alert( list[j]);
}
}function setselect(ws){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++)
checkboxis[i].checked = ws;
}onload=function(){
var checkboxis = document.getElementsByName("checkbox");
for (var i=0; i<checkboxis.length; i++){
checkboxis[i].onclick=function(){selectBox(this)}
}
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<table width="120" border="1">
<tr>
<td colspan="2">
<input type="button" name="all" value="全选" onclick="selectBox('all')"/>
<input type="button" name="reverse" value="取消" onclick="selectBox('reverse')"/>
</td>
</tr>
<tr>
<td colspan="2">
checkbox1<input type="checkbox" name="checkbox" value="checkbox1" />
</td>
</tr>
<tr>
<td width="110">
checkbox2<input type="checkbox" name="checkbox" value="checkbox2" />
</td>
</tr>
<tr>
<td colspan="2">
checkbox3<input name="checkbox" type="checkbox" id="checkbox" value="checkbox3" />
</td>
</tr>
</table>
</form></body>
</html>