Hi,
Lars Vatland wrote:
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:
<a href="javascript:goto([foo])">foo</a>
Or refer to it globally?
document.links.href.text.value ?
this.href.text ?
The text of a link should, according to the Netscape doc, be accessible with
linkInstance.text;
However, there doesn't seem to be a way to identify a link namely. Of
course you can always use the links array, but working with indexes is
not good programming practice, except in loops of course.
alert( document.links[2].text );
It seems, however, to be the only way.
Note also that this fails in IE, which doesn't seem to recognize the
property "text" of the Link instance (alerts "undefined").
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript
:
http://www.galasoft-LB.ch
Private/Malaysia:
http://mypage.bluewin.ch/lbugnion
Support children in Calcutta:
http://www.calcutta-espoir.ch