如何使<div>标记表现为<a href="https://i.stack.imgur.com/23dBr.png" rel="nofollow noreferrer">a and c variable&#39;s error</a> <p> <a> tag for the mouse right click event?

时间:2018-12-26 20:43:57

标签: html5

Is there a way to show "Open Link in New Tab", and "Open Link in New Window" etc.. by right-clicking on a div tag as same as an "a" tag with href attribute?

1 个答案:

答案 0 :(得分:0)

您可能可以使用JavaScript提供自定义的右键菜单:

el.addEventListener('contextmenu', function(ev) {
    ev.preventDefault();
    alert('Custom menu !');
    return false;
}, false);