修改样式属性
<style> div { width: 50px; height: 50px; background-color: aquamarine; } </style> </head> <body> <div>1</div> </body> <script> let dv = document.querySelector("div"); dv.onclick = function () { dv.style.width = "200px"; dv.style.height = "200px"; dv.style.backgroundColor = "pink"; }; </script>

浙公网安备 33010602011771号