<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
#box1{
width: 100px;
height: 100px;
background-color: red;
}
</style>
<script type="text/javascript">
window.onload = function(){
/*
点击按钮后,修改box1的大小
*/
//获取box1
var box1 = document.getElementById("box1");
//为按钮绑定单机响应函数
var btn01 = document.getElementById("btn01");
btn01.onclink = function(){
//修改box1的宽度
box1.style.widtn = "300px";
box1.style.height = "300px";
box1.style.backgroundColor = "yellow";
};
};
</script>
</head>
<body>
<button id="btn01">点我一下</button>
<br /><br />
<div id="box1"></div>
</body>
</html>