PDA

View Full Version : Change text On a link in NS7


requestcode
10-15-2002, 07:36 PM
The script below works with IE6 fliping the text to "Me" when you mouse over it and back to "Click" when you mouse out. In NS7 it only flips the text to "Me" when you mouse over, but not back to "Click" when you mouse out. Any pointers on what I need to do to get this to work in both browsers? Is there another approach that I should take? Thank you.
<html>
<head>
<title>Change Text On Link</title>
<SCRIPT LANGUAGE="JavaScript">
function chgtxt(lktext)
{document.getElementById('lnk1').innerHTML=lktext}
</SCRIPT>
</head>
<body>
<a href="somepage.html" id="lnk1" onMouseOver="chgtxt('Me')" onMouseOut="chgtxt('Click')">Click</A>
</body>
</html>

requestcode
10-16-2002, 01:21 PM
Any Idea's Guys? I am stuck on this one.

jkd
10-16-2002, 02:58 PM
Do something like:

onmouseover="changeText(this, 'hello')" onmouseout="changeText(this, 'something else')"


And in changeText:

function changeText(elNode, str) {
elNode.firstChild.nodeValue = str;
}

requestcode
10-16-2002, 03:42 PM
jkd your wonderful. Works like a charm. I guess that is why your a "Super Moderator"! :D