JavaScript设置样式 通过JavaScript设置样式 <body> <div id="box"></div> </body> <script type="text/javascript"> //获取DOM对象 var box = document.getElementById("box") box.style.width = "300px" box.style.height = "300px" //设置背景颜色 // box.style["background-color"]= " blue " box.style.backgroundC