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 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短