jquery js处理

编程技巧:智慧选择路径,省力又高效
    在编写了这么长时间的程序后,也有了一些自己的感悟,有时候动动脑子可以节省很大的力气,虽然条条大路通罗马,但是为什么不动动脑子想想,选择一条最近最好的路呢?而这些路往往隐藏在杂草中,需要动脑寻找,才能最快享受成功的喜悦!
   功能一:点击那个选中那个,如图
jquery <wbr>js处理
可以换图片,可以换背景,个人认为换背景比较省力气,有两个css
    .fatherchoose{
    width: 47px; height: 47px; background-repeat: no-repeat;
    }
     .fatherchooseCurr{
    width: 47px; height: 47px; background-image: url('/system/images/father/fathmanbg.png'); background-repeat: no-repeat;
    }
以下是 jsp页面代码:
<-td colspan="2">
<-div class="fatherchooseCurr">
<-a href="/system/selectFatherList${requestScope.ps_xmsf}" target="listIFrame" onclick="ssk(this)">
<-img  src="/system/images/father/xmsf.png" width="45" height="45" alt="" ></a> </div>
</td>
<-td>
<-div class="fatherchoose">
<-a href="/system/selectFatherList${requestScope.ps_laojiao}" target="listIFrame" onclick="ssk(this)"><img   src="/system/images/father/laojiao.png" width="45" height="45" alt=""></a>
</div></td>


所调用的js方法:
function ssk(obj){
$(" div .fatherchooseCurr").attr("class","fatherchoose");//最牛的div 点(.)选择器,不要是一直在存在,从未被使用啊,以后要用!
$(obj.parentNode).attr("class","fatherchooseCurr");
}
非常简单吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值