<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>DOM样式</title>
<script type="text/javascript">
/*
DOM样式的修改:
对象.style.属性名=属性值;
CSS DOM
width width
height height
background-color backgroundColor
font-size fontSize
border-color borderColor
... ...
DOM样式值的获取:
1.对象.style.属性名
只能获取行内样式
2.
window.getComputedStyle(对象,null)
获取指定对象的所有样式
*/
</script>
</head>
<body>
<div id="box"></div>
<script type="text/javascript">
var o=document.getElementById("box");
o.style.width="150px";
o.style.height="150px";
o.style.backgroundColor="red";
o.innerHTML="哈哈";
o.style.textAlign="center";
o.style.lineHeight="150px";
o.style.color="white";
</script>
</body>
</html>