鼠标悬停在网页上的链接上时如何隐藏浏览器状态栏上的链接?

2021-12-29 00:00:00 jquery php ajax zend-framework statusbar

我在我的项目中使用 Zend、PHP、AJAX、JQuery.问题是,当我将鼠标悬停在网页上的链接上时,如何强制不在浏览器的状态栏上显示链接.

I am using Zend, PHP, AJAX, JQuery in my projects. Question is that how can I force to not display a link on browser's statusbar when I mouseover on a link on my webpage.

最好的例子是在这个网站上,当你将鼠标悬停在这个网站上的up-vote链接上时,它不显示该链接,点击后投票增加而不刷新页面.

Best example is on this site, when you mouseover the up-vote link on this site, it does not show the link and after click the votes increased without refreshing the page.

谢谢

推荐答案

在 Stack Overflow 上,您看不到地址,因为它不是链接(即它不是锚点).它是一个跨度、图像或其他元素,带有一个 onclick 事件处理程序.

On Stack Overflow, you don't see an address, because it isn't a link (i.e. it isn't an anchor). It is a span, image or other element, with an onclick event handler.

这是确保所有浏览器中都没有状态栏文本的唯一方法,就像设置 window.status = "" 的老式 JavaScript 方法一样;目前在大多数浏览器中都没有效果.

This is the only way to guarantee no status-bar text in all browsers as the old-school JavaScript method of setting window.status = ""; has no effect in most browsers these days.

例如……

[Html]
<img id="clickme" src="myimage.png" alt="My Image" title="Vote">

[JavaScript (jQuery)]
$("#clickme").click(function() { alert("You clicked me"); });

相关文章