JavaScript文本标签的基本操作
## 1.文本内容操作
(1)获取标签
document.querySelector(“选择器文本”);
<div class='box'>
</div>
var box=document.querySelector(".box");
(2)赋值
box.innerHTML=“新内容”; --可以解析标签
box.innerText=“新内容”; --只显示文本内容
box.innerHTML=“内容”;
box.innerText=“内容”;
## 2.文本标签样式的操作
(1)获取标签
document.querySelector(“选择器文本”);
<div class='box'>
</div>
var box=document.querySelector(".box");
(2)改样式
box.style.样式=“”; //补充如果样式是复和样式基本都是遵循小驼峰命名法
box.style.height=“100px”;
box.style.width=“100px”;
box.style.backgroundColor=“red”;
box.style=“height:100px;width:100px;background-color:red”;