js中改变颜色 onclick backgroundColor
关键词: onclick backgroundColor
<html>
<meta charset="utf-8">
<title></title>
<body>
<div style="width:300px;height:300;background:red;"
onclick="bianse(this)">点击</div>
</body>
<script>
function bianse(obj){
obj.style.backgroundColor='green'
}
</script>
</html>