javascript实现控制div颜色
js控制div颜色
<html>
<head>
</head>
<style>
#div1{width:400px;height:400px;background-color:red;}
</style>
<script>
functionblue(){
div1=document.getElementById('div1');
div1.style.backgroundColor='blue';
}
functionpink(){
div1=document.getElementById('div1');
div1.style.backgroundColor='pink';
}
functionblack(){
div1=document.getElementById('div1');
div1.style.backgroundColor='black';
}
</script>
<body>
<buttononclick='wr();'>生成文字</button>
<buttononclick='blue();'>blue</button>
<buttononclick='pink();'>pink</button>
<buttononclick='black();'>black</button>
<divid='div1'>
</div>
以上所述就是本文的全部内容了,希望大家能够喜欢。
热门推荐
10 幼儿转园祝福语简短
11 小孩生日送花祝福语简短
12 朋友的孩子祝福语简短
13 过年祝自己祝福语简短
14 最佳元旦祝福语简短学校
15 古风考试祝福语 唯美简短
16 9字虎年简短祝福语
17 友情祝福语简短小故事
18 海南考试祝福语结婚简短