javascript event对象操作
js代码:
1 $(".leads_detail").click(function(e){ 2 3 e = e || event; 4 5 var t = e.target || e.srcElement; 6 7 var leads_id = $(this).data('id'); 8 9 if (t.id == "leads_track") { 10 11 window.open("<?=Url::toRoute(['leads-track'])?>" + "?leads_id=" + leads_id); 12 13 } else { 14 15 window.open("<?=Url::toRoute(['leads-detail'])?>" + "?leads_id=" + leads_id); 16 17 } 18 19 });
javascript [event对象的具体功能是什么]
JS中的event 对象包含哪些东西 event,[实例 详解]
event获得鼠标点击的DOM对象:
1 document.onclick=function(e){ 2 var evt = window.event || e; 3 var _target = evt.srcElement || evt.target; 4 alert(_target.tagName) 5 }
_target 为HTML DOM Element 对象,dom 对象的具体方法和属性:
参考:JS中的event属性总结 等等