Changing <SPAN... with JS ?

Discussion in 'Javascript' started by Jeff, Oct 11, 2003.

  1. Jeff

    Jeff Guest

    Hello everyone,

    It's possible to change the XXX in this statement with JS?

    <span id="myspan" class="standard-text">XXX</span>

    Thanks very much
     
    Jeff, Oct 11, 2003
    #1
    1. Advertisements

  2. Jeff

    Evertjan. Guest

    Jeff wrote on 11 okt 2003 in comp.lang.javascript:
    document.getElementById("myspan").innerHTML = "with JS"

    ;-)
     
    Evertjan., Oct 11, 2003
    #2
    1. Advertisements

  3. Jeff

    DU Guest


    document.getElementById("myspan").firstChild.nodeValue = "with JS";
    is faster, more efficient, is very well supported by current browsers
    and is entirely compliant with DOM 2.

    innerHTML versus nodeValue performance comparison
    http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/innerHTMLvsNodeValue.html

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
    http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
     
    DU, Oct 11, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.