点一下,让图片变得更大
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#box{
width: 200px;
height: 200px;
background-color: red;
}
</style>
<script type="text/javascript">
window.onload=function(){
document.getElementById("btn").onclick=function(){
document.getElementById("box").style.width="400px";
document.getElementById("box").style.height="400px";
}
}
</script>
</head>
<body>
<input type="button" name="btn" id="btn" value="确认">
<div id="box"></div>
</body>
点击确认
先画出图片,再用onload函数,你点不点,点了我就变大,
当然有个触发事件的按钮