Results 1 to 3 of 3

Thread: accesing the text of an <a> tag in javascript *resolved*

  1. #1

    Thread Starter
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596

    accesing the text of an <a> tag in javascript *resolved*

    how can i access the text of an <a> tag with javascript?? say something like this:
    Code:
    <script>
    function myFunction(){
    alert(document.links[0].text)
    }
    </script>
    <a href="http://address">this is the text i want myFunction to display</a>
    <form>
    <input type="button" onclick="myFunction()">
    </form>
    i don't know what i need to write instead of "text"!

    please help me!!
    Last edited by seec77; Feb 21st, 2003 at 07:37 AM.
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Code:
    alert(document.links[0].innerHTML);

  3. #3

    Thread Starter
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596
    all right, thnx a heap!
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width