www.webdeveloper.com
Results 1 to 4 of 4

Thread: Change text of a hyperlink

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    2

    Change text of a hyperlink

    I'm developing in ASP.NET with C#.

    I have an "hyperlink". I want to change the text attribute when a javascript function is called.


    Here's what I have in the code:
    <a id="ExpColLink" href="javascript:fun('ExpColLink');" style="font-family:Arial;font-size:X-Small;">Expand/Collapse All</a>


    function fun(obj)
    {
    var ECLink = obj;
    ECLink.Text = 'Different Text';
    }

  2. #2
    Join Date
    Aug 2006
    Location
    Turkey
    Posts
    242
    Code:
      
    <script type="text/javascript">
    function fun(obj)
    {
    var el = document.getElementById(obj);
    el.innerHTML = 'Different Text';
    }
    </script>
    <a id="ExpColLink" href="javascript:fun('ExpColLink');" style="font-family:Arial;font-size:X-Small;">Expand/Collapse All</a>

  3. #3
    Join Date
    Jul 2007
    Posts
    2

    Thanks

    for that

  4. #4
    Join Date
    May 2004
    Location
    FL
    Posts
    3,453
    samanyolu - nice snippet. Mind if I post it over at JavaScript Source? Just give me the name and URL you want me to include for credit.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles