//html
<div id="div1" style="background:red;">
修改背景颜色
</div>
<button type="button" onclick="update();">修改背景</button>
//js
update = function (){
var div1 = document.getElementById('div1');
div1.style.backgroundColor="black";
}
//html
<div id="div1" style="background:red;">
修改背景颜色
</div>
<button type="button" onclick="update();">修改背景</button>
//js
update = function (){
var div1 = document.getElementById('div1');
div1.style.backgroundColor="black";
}