html点击按钮状态改变,点击按钮改变CSS样式点击按钮改变CSS样式
* {
padding:0px;
margin:0px;
}
.box {
width:300px;
height:300px;
border:1px solid #CBC4F7;
font-size:13px;
margin:100px auto;
}
.divWidth {
width:400px;
}
.divHeight {
height:400px;
}
.divBgColor {
background-color:#DCF3B1;
}
p {
padding:15px 5px;
}
ul li {
list-style:none;
width:140px;
height:32px;
text-align:center;
line-height:32px;
background-color:#C4EA84;
border:1px solid #9BEA75;
margin:0px auto;
margin-bottom:10px;
cursor:pointer;
background-image:-webkit-linear-gradient(top, #C4EA84, #53AC28); background-image:-moz-linear-gradient(top, #C4EA84, #53AC28); background-image:-o-linear-gradient(top, #C4EA84, #53AC28);
-webkit-border-radius:4px;
-moz-border-radius:4px;
-o-border-radius:4px;
}
window.οnlοad=function(){
var btn1 = ElementById("btn1");
var btn2 = ElementById("btn2");
var btn3 = ElementById("btn3");
funClick = function(btnID,changeClass){css鼠标点击样式
var boxClass = btnID.parentNode.parentNode.className;
var ifClass = boxClass.indexOf(changeClass);
if(ifClass < 0){
boxClass = boxClass + " " + changeClass;
}else {
boxClass = place(changeClass,"");
}
btnID.parentNode.parentNode.className = boxClass;
}
}
funClick(btn1,"divWidth");
funClick(btn2,"divHeight");
funClick(btn3,"divBgColor");
}
这⾥是少许⽂本
点我调整宽度
点我调整⾼度
点我调整背景颜⾊
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论