日期:2014-05-17 浏览次数:20937 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<script type="text/javascript">
window.onload = function() {
var all = document.getElementById("all");
//注意: all.onchange=selectAll()
//表示调用方法并将其返回值赋值
all.onchange = selectAll;
document.getElementById("reverse")
.onchange = function() {
var inps =
document.getElementsByTagName("input");
for(var i=0;i<inps.length;i++) {
var type = inps[i].getAttribute("type");
if("checkbox" == type) {
if("all" !=
inps[i].getAttribute("id") ) {
inps[i].checked = !inps[i].checked;
}
}
}
};
}
function selectAll() {
var flag = this.checked;
var inps =
document.getElementsByTagName("input");
for(var i=0;i<inps.length;i++) {
var type = inps[i].getAttribute("type");
if("checkbox" == type) {
if(inps[i].getAttribute("id") ==
"reverse" ) {
inps[i] = false;
}else {
&nb