Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

To get the Hyperlink Control text in Javascript?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy - 25 Jun 2007 21:28 GMT
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
bruce barker - 25 Jun 2007 21:55 GMT
the hyperlink is an anchor.

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

-- bruce (sqlwork.com)

> Hi,
> Two very related questions.
[quoted text clipped - 8 lines]
> Many thanks!
> Spud
Andy - 25 Jun 2007 22:27 GMT
Many thanks Bruce,
Between your post and
http://www.w3schools.com/js/tryit.asp?filename=try_dom_anchor_href I'm sure I
can get there.

> the hyperlink is an anchor.
>
[quoted text clipped - 16 lines]
> > Many thanks!
> > Spud

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.