wariar
asked on
Text on the link
How can I store the text of a link in a variable?
You can't... at least not in HTML alone.
ASKER
I can try Javascript too. Thanks!
this doument might help u http://developer.netscape.com/docs/manuals/js/client/jsref/link.htm#1193137
DC
DC
I think...
<a href="asdf" name="linkname">Test</a>
document['linkname'].text = Test
or
document.linkname.text = Test
<a href="asdf" name="linkname">Test</a>
document['linkname'].text = Test
or
document.linkname.text = Test
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%>"><%=strL inkText%>< /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
<%
DIM strLinkText
strLinkText = "whatever"
%>
And then further in the page where you have the link put:
<a href="http://blah" name = "<%=strLinkText%>"><%=strL
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
ASKER
I would like to accept Tyoung's answer. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hope that helps!
Hey thanx!
ASKER