Text on the link

How can I store the text of a link in a variable?
wariarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wariarAuthor Commented:
How can I retrieve the hypertext on a link?
0
gravityCommented:
You can't... at least not in HTML alone.
0
wariarAuthor Commented:
I can try Javascript too. Thanks!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

deepchandaCommented:
0
TYoungCommented:
I think...

<a href="asdf" name="linkname">Test</a>

document['linkname'].text = Test
or
document.linkname.text = Test
0
nigesCommented:
I would say the best way to do it would be to use ASP as it is quick and easy. Up the top of the page have a block of text like
<%
   DIM strLinkText
   strLinkText = "whatever"
%>

And then further in the page where you have the link put:
<a href="http://blah" name = "<%=strLinkText%>"><%=strLinkText%></a>

and it should work

then whenever you want to use the link text, all you need to do is type
<%=strLinkText%> and the content of the linktext will be displayed on the screen. If you would like to use it over multiple pages, you can put it in a session variable with the command

session("LinkText") = strLinkText after it has had a value put in it, and then you can refer to it (within your session timeout period - usually around 20 minutes) with
<%=session("LinkText")%> on any page in the current site.

Cheers,

Nige
0
wariarAuthor Commented:
I would like to accept Tyoung's answer. Thanks!
0
TYoungCommented:
Will you? I need some points.
click the:
Click Here To Accept Comment As Answer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wariarAuthor Commented:
Hope that helps!
0
TYoungCommented:
Hey thanx!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.