标签:java click 改变 ext function TE cli cte sele
<script type="text/javascript">
$(document).ready(function(){
$(‘li‘).click(function(){
/* 将所有li样式替换为cz(默认样式) */
$(‘li‘).removeClass(‘selected-cz‘);
$(‘li‘).addClass(‘cz‘);
/* 将选中的li样式更改为selected-cz */
$(this).removeClass(‘cz‘);
$(this).addClass(‘selected-cz‘);
/* 将所有图片替换为默认图片 */
var allImg = $("li img");
for ( var i = 0; i < allImg.size(); i++) {
if (i % 2 == 0) {
$(allImg[i]).attr("src", "${ctxStatic}/modules/fstore/images/chongzhi_qqq.png");//改变img的src
} else {
$(allImg[i]).attr("src", "${ctxStatic}/modules/fstore/images/chongzhi_jf.png");
}
}
//当前li中的img
var imgs = $("img", this);
for ( var i = 0; i < imgs.size(); i++) {
if (i == 0) {
$(imgs[i]).attr("src", "${ctxStatic}/modules/fstore/images/chongzhi_qq.png");
} else {
$(imgs[i]).attr("src", "${ctxStatic}/modules/fstore/images/chongzhi_jfz.png");
}
}
});
});
</script>
标签:java click 改变 ext function TE cli cte sele
原文地址:https://www.cnblogs.com/kittycat/p/9203013.html