鼠标点击一个div,另一个div变色
demo在我的资源中
<html>
<head></head>
<body>
<style>
#div1{
width: 200px;
height: 200px;
border:1px solid #000;
}
</style>
<button onclick='blue();'>blue</button>
<button onclick='pink();'>pink</button>
<button onclick='black();'>black</button>
<div id='div1'>11111111</div>
<script>
function blue(){
div1=document.getElementById('div1');
div1.style.backgroundColor='blue';
div1.style.color='#fff';
}
function pink(){
div1=document.getElementById('div1');
div1.style.backgroundColor='pink';
div1.style.color='red';
}
function black(){
div1=document.getElementById('div1');
div1.style.backgroundColor='black';
div1.style.color='yellow';
}
</script>