<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function changeColor(str){
var body = document.getElementById("b");
body.style.backgroundColor = str;
}
</script>
</head>
<body id="b" >
<button onclick="changeColor('blue')">蓝色</button>
<button onclick="changeColor('red')">红色</button>
<button onclick="changeColor('green')">绿色</button>
</body>
</html>
鼠标事件案例—按钮切换背景颜色
最新推荐文章于 2024-07-04 20:21:08 发布
4562

被折叠的 条评论
为什么被折叠?



