摘要:<!doctype html> <html> <head> <meta charset="utf-8"> <title>changeDIV</title> <style> #box{width:100px;height:100px; background:red;&
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>changeDIV</title>
<style>
#box{width:100px;height:100px; background:red; margin:10px 80px;}
</style>
</head>
<body>
<script type="text/javascript">
var box
window.onload = function(){
box = document.getElementById('box')
}
//高度
function h(){
box.style.height = "300px"
}
//宽度
function w(){
box.style.width = "300px"
}
//颜色
function b(){
box.style.background = "#09F"
}
function d(){
box.style.height = "100px"
box.style.width = "100px"
box.style.background = "red"
}
function e(){
box.style.display = "none"
}
function f(){
box.style.display = "block"
}
</script>
<div id="box"></div>
<input type="button" value="变高" onClick="h()">
<input type="button" value="变宽" onClick="w()">
<input type="button" value="变色" onClick="b()">
<input type="button" value="重置" onClick="d()">
<input type="button" value="隐藏" onClick="e()">
<input type="button" value="显示" onClick="f()">
</body>
</html>
批改老师:查无此人批改时间:2019-05-09 14:27:28
老师总结:完成的不错。js每行语句结束要增加;号,继续加油