gpt4 book ai didi

javascript - 隐藏鼠标悬停链接的 URL

转载 作者:行者123 更新时间:2023-11-28 10:48:44 25 4
gpt4 key购买 nike

更新


我终于找到了一个简单易行的方法:

<font onclick="window.open('https://www.google.pt/', '_self');" style="background:0;border:0;outline:0">Link

我必须使用标签将事件添加到文本中,因此我使用了 font 因为它不会修改任何内容。 P.S.:这在 JS Fiddle 上不起作用,因为由于某种原因,它不会打开链接(它保持空白)。


可能重复,但我找不到它,有什么方法可以防止当我将鼠标移到链接上时显示链接的 URL?带有 URL 图像的代码:

<a href="https://www.google.pt/">Google</a>
<br>
When I over the mouse on the link, it shows the URL on the bottom left corner.
<br>
<img src="http://i.imgur.com/pq3ket7.png">
<br>
Is there any way to prevent it?
I'm using Chrome.

https://jsfiddle.net/1tbg478j/

最佳答案

JSFiddle 坏了,所以我将把所有代码粘贴到这里。请注意,这些链接在 JSFiddle 中不起作用,因为它们不允许 window.location,但它可以在您的网站中起作用。

HTML:

<a class="no-href" data-location="https://www.google.pt">Google</a><br />
<a class="no-href" data-location="https://www.google.com">Link 2</a><br />
<a class="no-href" data-location="https://www.google.co.za">Link 3</a><br />
<a href="https://www.google.pt/">Normal Link</a><br />
<br>
When I over the mouse on the link, it shows the URL on the bottom left corner.
<br>
<img src="http://i.imgur.com/pq3ket7.png">
<br>
Is there any way to prevent it?
I'm using Chrome.

JS:

$('.no-href').click(function(e){
e.preventDefault();
window.location = $(this).attr('data-location');
});

CSS:

.no-href {
color: blue;
cursor: pointer;
text-decoration: underline;
}

关于javascript - 隐藏鼠标悬停链接的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37569092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com