第2个回答 2012-03-12
例子1:
html代码:
<div style="cursor:pointer;width:100px;height:100px;" onclick="this.style.background='red';">点我</div>
例子2:
js代码:
function changeStyle(obj){
obj.style.background='red';
}
html代码:
<div style="cursor:pointer;width:100px;height:100px;" onclick="changeStyle(this)">点我</div>