<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函数,你点不点,点了我就变大,
当然有个触发事件的按钮

相关文章:

  • 2021-11-27
  • 2022-12-23
  • 2021-06-14
  • 2021-11-01
  • 2022-02-17
  • 2021-05-10
  • 2021-04-01
猜你喜欢
  • 2021-12-28
  • 2022-12-23
  • 2021-09-25
  • 2022-03-07
  • 2022-01-07
  • 2022-12-23
  • 2022-02-01
相关资源
相似解决方案