javaScript中为标签写入属性
拿到标签后通过 点style点具体属性 = “值” 的方式设置
为div标签写入宽高和背景色
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="box">
</div>
<script type="text/javascript">
var box = document.getElementById("box")
box.style.width = "200px"
box.style.height = "300px"
box.style.backgroundColor = "red"
</script>
</body>
</html>