<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
#div1{
height:300px;
width:500px;
background-color:lightblue;
color:black;
margin:100px auto;
}
</style>
</head>
<body>
<div id="div1">
<p>虽然我也不知道输入什么</p>
<p>那我就瞎他妈写一写吧</p>
<p>哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。</p>
</div>
<form>
<input type="button" onclick="color()" value="改变颜色">
<input type="button" onclick="wh()" value="改变宽高">
<input type="button" onclick="hh()" value="隐藏">
<input type="button" onclick="see()" value="显示">
<input type="button" onclick="hde()" value="取消设置">
</form>
<script type="text/javascript">
function color(){
var d=document.getElementById("div1");
d.style.color="red";
d.style.background-color="green";
}
//改变颜色
function wh(){
var div1=document.getElementById("div1");
div1.style.width="800px";
div1.style.height="200px";
//改变宽高
}
function hh{
var div1=document.getElementById("div1");
div1.style.display="none";
}//隐藏
function see(){
var div1=document.getElementById("div1");
div1.style.display="block";
}//显示
function hde(){
var div1=document.getElementById("div1");
var x=confirm("是否取消设置?");
if(x==true){
div1.style.height="300px";
div1.style.width="500px";
div1.style.background-color="blue";
div1.style.color="black";
div1.style.margin="100px auto";
}
else{
alert("不要搞事情");
}
}//取消设置
</script>
</body>
</html>
background-color 改为:backgroundColor hh函数少了 () 加油!!!!加油!!!!