To get the Hyperlink Control text in Javascript?

G

Guest

Hi,
Two very related questions.

a) On clicking a hyperlink control I need to be able to GET the text of the
control. How can I do this?
b) How can I then SET the text of the hyperlink control to something else?

This can;t be hard but is so far eluding me (new to JS - managed to get by
without it for years!)

Many thanks!
Spud
 
B

bruce barker

the hyperlink is an anchor.

var hl = document.getElementById('<%=myHyperlink.ClientID%>');
var oldText = hl.innerHTML;
hl.innerHTML = '<b>new text</b>';

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,100
Latest member
MelodeeFaj
Top