SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, all!

    I was wondering if I could change the text of a link with a JavaScript. I want to set it up with a JavaScript function so that when A link is clicked on, the text of that link changes and it points to a different function.

    Any suggestions? Thanks.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  2. #2
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    You can easily do this in IE 4 + and NS 6. However, for NS 4, you'd have to use layers, and reqrite the whole <a> tag:

    Code:
    <a href="javascript:someFunction()" onclick="this.innerHTML='New Text';this.HREF='javascript:someNewFunction()'">Old Text</a>
    aDog

  3. #3
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aDog,

    Thanks! The solution works well, but after consideration of the NS4 browser, i decided to abandon the thought.

    I was actually just playing around to see if i COULD in fact do this. You helped me.

    Thanks again!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)


Bookmarks

Posting Permissions

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