摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>js</title>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js</title>
<style>
#box{
width: 100px;
height: 100px;
background-color: red;
}
</style>
</head>
<body>
<div id="box"></div>
<input type="button" value="变宽" onclick="aa()">
<input type="button" value="变高" onclick="bb()">
<input type="button" value="换颜色" onclick="cc()">
<input type="button" value="隐藏" onclick="dd()">
<input type="button" value="显示" onclick="ee()">
<input type="button" value="重置" onclick="ff()">
<script type="text/javascript">
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='pink'; //更换颜色
}
function dd() {
box.style.display='none'; //隐藏
}
function ee() {
box.style.display='block';
}
function ff() {
box.style.display='block';
box.style.width='100px';
box.style.height='100px';
box.style.background='red';
}
</script>
</body>
</html>
批改老师:灭绝师太批改时间:2018-11-08 13:24:27
老师总结:完成的不错,只是函数名不要学老师呐,可以用的专业点