📌  相关文章
📜  检测在所有地方点击链接的javascript代码示例

📅  最后修改于: 2022-03-11 15:03:04.533000             🧑  作者: Mango

代码示例1
function clickOrigin(e){
    var target = e.target;
    var tag = [];
    tag.tagType = target.tagName.toLowerCase();
    tag.tagClass = target.className.split(' ');
    tag.id = target.id;
    tag.parent = target.parentNode.tagName.toLowerCase();

    return tag;
}

var tagsToIdentify = ['img','a'];

document.body.onclick = function(e){
    elem = clickOrigin(e);

    for (i=0;i