Entry
How can I change the content of a link?
Mar 13th, 2001 07:02
Martin Honnen,
IE4+ and NN6 allow that by setting the
innerHTML
property of the link element. It works however more reliably in NN6 to
use DOM methods:
<HTML>
<HEAD>
<SCRIPT>
function setLinkContent (link, content) {
if (document.all)
link.innerText = content;
else if (document.getElementById)
link.firstChild.nodeValue = content;
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="http://JavaScript.FAQTs.com"
ONMOUSEOVER="setLinkContent(this, 'JavaScript.FAQTs ...');"
ONMOUSEOUT="setLinkContent(this, 'JavaScript.FAQTs');"
>JavaScript.FAQTs</A>
</BODY>
</HTML>