标签:
js
var fn=function(){...} var callback=function(e){ if(e.target.tagName==‘li‘){ fn(); } } if(document.attachEvent){ document.attachEvent("onclick",callback); }else if(document.addEventListener){ document.addEventListener("click",callback,false); }else{ document[‘onclick‘]=callback; }
jquery
$(document).delegate("li","click",fn);
标签:
原文地址:http://www.cnblogs.com/xiaotaiyang/p/5693976.html