0
点赞
收藏
分享

微信扫一扫

修改样式属性

杨小羊_ba17 2022-06-16 阅读 68

 

<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>

 


举报

相关推荐

0 条评论