views:

244

answers:

4

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.

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.

Thanks

A: 

The status bar highlighting happens only when you use an <a> element with a set href.

If you use pure JavaScript to open your link, and don't assign a href attribute, nothing will turn up in the status bar.

Pekka
… and you'll be violating rule 2: http://icant.co.uk/articles/pragmatic-progressive-enhancement/#build
David Dorward
True, but depending on scenario, it may not matter to the OP. I don't see a reliable way of doing this without violating a rule.
Pekka
+3  A: 

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.

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.

So, for example...

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

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

if you can see (view source ), the vote up link on the side is not a link, it is an image. If you click on it, it fires an ajax function call on this link, http://stackoverflow.com/posts/2207467/vote/, which updates the database.

Reigel
+3  A: 

Older browsers had something like window.status = ""; where you could send messages to the status bar, and likewise effectively hide normal messages.

This is no longer supported on most browsers.

So, if you use a hyperlink - or more specifically an anchor element <a> - with an href attribute, there's no getting around the status bar.

If you check out the HTML for SO, you'll see the vote up "link" isn't a link at all but an image with some javascript event handlers assigned to the onclick event.

So why is that the cursor turns into that pointed finger when you mouse over the "vote up"? That's because of the CSS cursor property.

.vote img {
    cursor:pointer;
}

That CSS comes out of the 'all.css' stylesheet.

LeguRi