在编写了这么长时间的程序后,也有了一些自己的感悟,有时候动动脑子可以节省很大的力气,虽然条条大路通罗马,但是为什么不动动脑子想想,选择一条最近最好的路呢?而这些路往往隐藏在杂草中,需要动脑寻找,才能最快享受成功的喜悦!
功能一:点击那个选中那个,如图
.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");
}
非常简单吧!
编程技巧:智慧选择路径,省力又高效

2952

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



