Entry
How can I change link text dynamically according to the user clicked in Javascript?
Jan 28th, 2003 00:27
Klaus Bolwin, Mat hesh,
If the link has got an ID, you can script the link properties using:
link = document.getElementById(linkid);
else, you have to create an array, containing the links:
anchors = document.getElementsByTagName("a");
Now, you can get access to the link text using:
link.firstChild.nodeValue
or
anchors[i].firstChild.nodeValue
in Mozilla/Netscape6+ and all the other Gecko-based browsers
and
link.innerText
or
anchors[i].innerText
in MSIE