摘要:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><style> &nb
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
#box{
border: 1px solid black;
width: 100px;
height: 100px;
margin: 5px
}
</style>
<body>
<div id="box"></div>
<button onclick="aa()">變寬</button>
<button onclick="bb()">變長</button>
<button onclick="cc()">變色</button>
<button onclick="dd()">重置</button>
<button onclick="ee()">隱藏</button>
<button onclick="ff()">顯示</button>
<script>
var box;
window.onload = function () {
box = document.getElementById('box');
};
function aa() {
box.style.width='400px'
}
function bb() {
box.style.height='400px'
}
function cc() {
box.style.background='blue'
}
function dd() {
box.style.width='100px';
box.style.height='100px';
box.style.background='none';
}
function ee() {
box.style.display='none'
}
function ff() {
box.style.display='block'
}
</script>
</body>
</html>
批改老師:查無此人批改時間:2019-05-07 09:38:45
老師總結(jié):完成的不錯。js比較難,因?yàn)樗墓δ芊浅?qiáng)大。每行js語句結(jié)束增加;號。繼續(xù)加油。