How to display mouse over text on a link

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

How to display mouse over text on a link

Post by hawleyjr »

If you have an image you can use alt="my text" to display text when the mouse goes over the image.

Can you do this to a Href link?

Works:

Code: Select all

<img src="/pix/button_drop.png" alt="Delete test">
Doesn't work:

Code: Select all

<a href="#" alt="my text">Click Here</a>
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

I do not think that is possible. However, if it is possible then I am curious how that would work out!
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

They do it here: http://forums.devshed.com/archive/t-169198

But I believe they are using DHTML. I'll check it out.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<a href="#" title="my text" alt="my text">Click Here</a>
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

OK well I have just realised something. The link you posted has the links which contain "alt" however, it only works in IE and not mozilla. Interesting...
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

OK well feyd's code worked on both browsers, hmm

Code: Select all

<a href="#" title="my text">Click Here</a>
It appears that "title" is doing the work :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

older browsers will use the alt (if they support it outside img tags), and newer ones will use title..
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Ah I see, Thanks for the explination feyd!
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

they didn't do it like that else it would have worked in mozilla
they used

Code: Select all

.overlink &#123;
  	 cursor:pointer; 
  	 cursor:hand;
        text-decoration: underline;
&#125;
It's not a well written css, they tried putting hand and pointer to make it cross-browser, but it's not the right way.
Post Reply