<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.d1{
width: 100px;
height: 100px;
border: 1px solid;
}
.p1{
width: 200px;
height: 200px;
border: 3px solid;
}
.p2{
width: 300px;
height: 300px;
background: skyblue;
}
.active{
font-size: 50px;
}
</style>
</head>
<body>
<div id="box">
<div class="d1" name="myD1" data="d">
我是div
</div>
<span></span>
<p class="p1">
p
</p>
<button type="button" onclick="changeFn()">切换</button>
</div>
<script type="text/javascript">
var d1 = document.querySelector(".d1");
var p = document.querySelector("p&
JS:获取元素及操作元素代码
最新推荐文章于 2024-09-02 07:00:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)