鼠标点击Button1改变颜色,点击Button2恢复颜色,Button2改变颜色
html代码:
按钮1
按钮2
js原生代码:
window.onload = function(){
document.getElementById("btn1").onclick=function(){
this.style.background = "red";
document.getElementById("btn2").style.background = '#FFF';
}
document.getElementById("btn2").onclick=function(){
this.style.background = "red";
document.getElementById("btn1").style.background = '#FFF';
}
}
这是js干啥 一段简单的css就能做到呀
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.button{
border:none;
width:100px;
height:40px;
background: #0a56bb;
color: #fff;
}
.button:focus{
outline: none;
background-color: #f00283;
}
</style>
</head>
<body>
<button class="button item1">第一个按钮</button>
<button class="button item2">第二个按钮</button>
<button class="button item3">第三个按钮</button>
</body>
</html>
$("#button").click(function(){$(this).addClass("bg").sblings.removeClass("bg")})
.bg{background-color:red;}
你用的什么语言来实现?
改变背景色,还是按钮的颜色
android,java awt有直接设置颜色的方法,
百度就有
http://www.jb51.net/article/111309.htm 完整需求
点击按钮使用不同的样式。
通过点击事件,利用css来解决
是什么语言呀?html里吗?改变css?
你用的什么语言来实现?
改变背景色,还是按钮的颜色