JS编写点击页面弹出被点击的标签名

window.onload = function(){
    var oBtn = document.getElementsByTagName("*");
    for(var i=0;i<oBtn.length;i++){
        oBtn[i].onclick = function(event){
            console.log(this.tagName);
            //阻止事件冒泡
            event.stopPropagation();
        }
    }
}
原文地址:https://www.cnblogs.com/lcx90/p/5639570.html