Вы можете использовать window.location
, чтобы перенаправить пользователя.
HTML
<td oncontextmenu="gotoWiki(event);return false;">
<a href="..."title="Hydrogen">H</a><br>
2.20
</td>
JS
function gotoWiki(event) {
// Extract the target from the event
var target = event.target || event.srcElement;
// Get the link
var link;
if (target.tagName == "A") {
// If the target is an <a>-Tag, it's the link
link = target;
} else {
// Otherwise, get the first <a>-Tag
link = target.getElementsByTagName("a")[0];
}
// If getElementsByTagName() returned an element and it has the title attribute
if (link && title = link.getAttribute("title")) {
// Redirect
window.location.href = "http://en.wikipedia.org/wiki/" + encodeURIComponent(title);
}
}
Спасибо! Работайте отлично! – user2874096