<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input id="hang" placeholder="请输入行数"></br>
<input id="lie" placeholder="请输入列数">
<input type="button" onclick="shengcheng()" value="确认生成">
<table border="1px" id="biaoge" cellpadding="10px" cellspacing="0px"></table>
<script>
function shengcheng(){
var hang=document.getElementById("hang").value;
hang=parseInt(hang)//取值行数
var lie=document.getElementById("lie").value;
lie=parseInt(lie)//取值列数
var biaoge=document.getElementById("biaoge")//获取对象
for(i=1;i<=hang;++i){
x=document.createElement("tr")
biaoge.appendChild(x)//在table里添加tr
for(z=1;z<=lie;++z){
x.appendChild(document.createElement("td"))//在tr里添加td
}
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="checkbox" value="羽毛球" name="hobby" >羽毛球</br>
<input type="checkbox" value="马拉松" name="hobby">马拉松</br>
<input type="checkbox" value="乒乓球" name="hobby">乒乓球</br>
<input type="checkbox" value="跆拳道" name="hobby">跆拳道</br>
<input type="checkbox" value="击剑" name="hobby">击剑</br>
<input type="button" value="全选" onclick="x()"></br>
<input type="button" value="全不选" onclick="a()">
<script>
function x(){
y=document.getElementsByName("hobby")
for(i=0;i<y.length;++i){
y[i].checked=true
}
}
function a(){
y=document.getElementsByName("hobby")
for(i=0;i<y.length;++i){
y[i].checked=false
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="times"></div>
<script>
function time(){document.getElementById("times").innerHTML=new Date().getFullYear()+"年"+(new Date().getMonth()+1)+"月"+new Date().getDate()+"日"+new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds()}
setInterval(time,1000)//一秒刷新一次
</script>
</body>
</html>