点击事件-相同模块封装

简单实例1:

html部分:

 <img style="width:100%;height:100%" src="__ROOT__/Public/Uploads/VehiclePic/{$driverVehicle['vehiclePic'][0]['picName']}" onclick="openImages(this)">

js部分:

function openImages(object){
$("#vehicleOpendBox").show();
$("#vehicleOpendBox").find("img").attr("src",$(object).attr("src"));

 $(object).addClass("on");

}

简单实例2:

html部分:

<div class="TabADS bor_b clearboth relative ">
<ul>
<li class="TasADSOn Driver_Menu" onclick="openListBox(this,1)" >车辆信息</li>
<li class="Driver_Menu" onclick="openListBox(this,2)">收到的评价</li>
</ul>
</div>

js部分:

function openListBox(object,number){
$(".Driver_Menu").removeClass("TasADSOn");
$(object).addClass("TasADSOn");
if(number==1){
$("#Vehicle_List_Box").show();
$("#pingjiabox").hide();
}else{
$("#Vehicle_List_Box").hide();
$("#pingjiabox").show();
}
}

posted @ 2017-03-21 16:37  永往  阅读(698)  评论(0编辑  收藏  举报