日期:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script>
function meth01(butobj){//方法定义
var bool= new Date();
alert(""+bool.getFullYear()+(bool.getMonth()+1)+bool.getDate());
var Str = new String("asdasfsdgsf");
document.write(Str.fontcolor("Green"));
}
</script>
</head>
<body>
<form >
<input type="button" name="sex" id="male" value="测试" οnclick="meth01(this)"/>
<blink>aaaaaaa</blink>
</form>
</body>
</html>
全选、全部选:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<script>
function meth1(){
document.getElementById("chc1").checked=true;
document.getElementById("chc2").checked=true;
document.getElementById("chc3").checked=true;
document.getElementById("chc4").checked=true;
document.getElementById("chc5").checked=true;
}
function meth2(){
document.getElementById("chc1").checked=false;
document.getElementById("chc2").checked=false;
document.getElementById("chc3").checked=false;
document.getElementById("chc4").checked=false;
document.getElementById("chc5").checked=false;
}
</script>
</head>
<body>
<input id="chc1"type="checkbox" value="" name="ch" />
<input id="chc2"type="checkbox" value="" name="ch" />
<input id="chc3"type="checkbox" value="" name="ch" />
<input id="chc4"type="checkbox" value="" name="ch" />
<input id="chc5"type="checkbox" value="" name="ch" /><br>
<input id="bu1"type="button" value="全选" οnclick="meth1()"/>
<input id="bu2"type="button" value="全不选" οnclick="meth2()"/>
</body>
</html>
添加自动行列:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<script>
function row(){//行
var tb = document.getElementById("t1");
var tds = tb.getElementsByTagName("tr")[0].getElementsByTagName("td");
var tr1 = tb.insertRow();
for(var i=0;i<tds.length;i++){
var td1 = tr1.insertCell();
td1.innerHTML="水";
}
}
function cols(){//列
var tb = document.getElementById("t1");
var trs = tb.getElementsByTagName("tr");
for(var i=0;i<trs.length;i++){
var td1 = trs[i].insertCell();
td1.innerHTML="水";
}
}
</script>
</head>
<body>
<input type="button" value="添加行" οnclick="row()" />
<input type="button" value="添加列" οnclick="cols()" />
<table id="t1" border="1">
<tr> <td>学号</td><td>姓名</td><td>成绩</td> </tr>
<tr> <td>222333</td><td>涂勇</td><td>96</td> </tr>
</table>
</body>
</html>