v wrote:
thanx :-)
hmm.. but maybe you're right there.
Would it be possible to do the same with span, p or some other
elements.?
Please don't top post. In answer to the question, yes, but
there are better ways of achieving the same result.
[...]
Is it possible to use a simple code to modify all the anchor elements
on a web page to trigger a function
eg to display the link innnertext on the window status upon mouseover?
innerText is IE only and therefore will not work for an
increasing number of your visitors.
Most browsers display information in the status bar that, for
anchors, says where the link is going to. Some will also advise
if the link will open in a new window or tab too.
What is the point of showing the innnerText? Isn't it already
displayed on the screen as part of the document?
<a href="http://www.apple.com"
onmouseover="alert(this.innerText);">Here is a link</a>
Will display an alert with "Here is a link" for IE and
"undefined" for other browsers. A more cross-browser method is
available using DOM methods, but it seems pointless.
If you want a tool-tip, use the title attribute on your links:
<a href="http://www.apple.com"
title="Here is a link to Apple">Apple</a>
No JavaScript required at all. Otherwise, the method
described by Dietmar for attaching events is, in general, fine.
--
Fred