Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I change the text of this element?

    I have the following HTML.

    <li class="windowControl"><span id="detailsmaxlink"><img src="/images/refresh.gif" alt="Refresh" onclick="javascript:refresh('details')" class="refresh"><a href="javascript:maximize('details')">maximize</a></span></li>

    I want to be able to replace the text "maximize" between <A HREF>...</A>

    I don't know how to get to this via the DOM. i thought something like this would work.

    document.getElementById('detailsmaxlink').childNodes[0].childNodes[0].nodeValue = 'restore'

    but that doesn't work. What am I doing wrong?

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    The first child is not the link, it's the image before it.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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