页面click集合写法
作者:chrispy
$(window).click(function(obj){
//获取id
var id = obj.target.id;
//获取class
var className = obj.target.classClass;
//获取name
event.target.attributes["name"] ? name = event.target.attributes["name"].nodeValue : "";
//获取自定义index
event.target.attributes["index"] ? index = event.target.attributes["index"].nodeValue : "";
switch(id){
case "id1" :
alert("id1");
break;
case "id2" :
alert("id2");
break;
}
switch(className){
case "className1" :
alert("className1");
break;
case "className2" :
alert("className2");
break;
}
})