JS如何设置元素样式的方法示例
<div id="box"></div> <script> var box = document.getElementById("box"); box.style.width = '100px'; box.style.height = '100px'; box.style.backgroundColor = "#f00"; box.style.cssText = 'width: 200px; height: 200px; border: 1px solid #f00;'; </script>