js注册在标签上的点击事件

<div id="trFormatStr_1" onclick="fnTrClick(this)">点击</div>

function fnTrClick(dd){
    console.log("window对象",this, "当前对象",$(dd).attr("id"));
}
给onclick传递一个this,点击的当前对象,在函数中使用的this是window对象

posted @ 2016-07-25 16:51  ning0_o  阅读(507)  评论(0编辑  收藏  举报