在本文中用jquery对class属性的操作方法实现页面中的按钮开关效果。
首先定义两个class:
. 代码如下:
.controloff{
display:inline-block;
width:130px;
height:36px;
cursor:pointer;
background-image:url("../iclass/images/teach_off.png");
background-repeat: no-repeat;
}
.controlon{
display:inline-block;
width:130px;
height:36px;
cursor:pointer;
background-image:url("../iclass/images/teach_on.png");
background-repeat: no-repeat;
}
. 代码如下:
<a href='javascript:void(0)' id='teachcontrol' class='controloff'></a>
. 代码如下:
function switchteachcontrol(){
var target = $("#teachcontrol");
if(target.hasclass("controloff")){
target.removeclass("controloff");
target.addclass("controlon");
}else{
target.removeclass("controlon");
target.addclass("controloff");
}
}
如对本文有疑问, 点击进行留言回复!!
MFC的静态库.lib、动态库.dll(包含引入库.lib)以及Unicode库示例
CTF 刷题记录(一) 白云新闻搜索(手动与自动化SQL注入)
javascript如何使用函数random来实现课堂随机点名方法详解
网友评论