A simple javascript code not working on Firefox

Discussion in 'Javascript' started by fulio pen, Sep 9, 2008.

  1. fulio pen

    fulio pen Guest

    Hello,

    I have a code that works on both the IE and Opera, but not the
    Firefox, and I cannot figure out the reason. Following is the page:

    http://www.pinyinology.com/test/span2.html

    And following is the code:

    function chinText()
    {
    document.getElementById("moon").innerText ="\u6708";

    document.getElementById("tree").innerText ="\u6728";

    document.getElementById("man").innerText ="\u4eba";

    document.getElementById("water").innerText ="\u6c34";
    }

    Thanks for your expertise and help.
    fulio pen
    fulio pen, Sep 9, 2008
    #1
    1. Advertising

  2. fulio pen

    Tom Cole Guest

    On Sep 9, 7:37 am, fulio pen <> wrote:
    > Hello,
    >
    > I have a code that works on both the IE and Opera, but not the
    > Firefox, and I cannot figure out the reason.  Following is the page:
    >
    > http://www.pinyinology.com/test/span2.html
    >
    > And following is the code:
    >
    > function chinText()
    > {
    >   document.getElementById("moon").innerText ="\u6708";
    >
    > document.getElementById("tree").innerText ="\u6728";
    >
    > document.getElementById("man").innerText ="\u4eba";
    >
    > document.getElementById("water").innerText ="\u6c34";
    >
    > }
    >
    > Thanks for your expertise and help.
    > fulio pen


    Firefox does not support the innerText function. You can use an
    alternative, (like innerHTML) which is also not standard, but
    supported in most browsers.
    Tom Cole, Sep 9, 2008
    #2
    1. Advertising

  3. fulio pen

    fulio pen Guest

    On Sep 9, 7:49 am, Tom Cole <> wrote:
    > On Sep 9, 7:37 am, fulio pen <> wrote:
    >
    >
    >
    > > Hello,

    >
    > > I have a code that works on both the IE and Opera, but not the
    > > Firefox, and I cannot figure out the reason.  Following is the page:

    >
    > >http://www.pinyinology.com/test/span2.html

    >
    > > And following is the code:

    >
    > > function chinText()
    > > {
    > >   document.getElementById("moon").innerText ="\u6708";

    >
    > > document.getElementById("tree").innerText ="\u6728";

    >
    > > document.getElementById("man").innerText ="\u4eba";

    >
    > > document.getElementById("water").innerText ="\u6c34";

    >
    > > }

    >
    > > Thanks for your expertise and help.
    > > fulio pen

    >
    > Firefox does not support the innerText function. You can use an
    > alternative, (like innerHTML) which is also not standard, but
    > supported in most browsers.


    Hi, Tom:

    innerHTML works well. Thanks a million for your help.

    fulio pen
    fulio pen, Sep 9, 2008
    #3
  4. Tom Cole wrote:
    > Firefox does not support the innerText function.


    Correct, except that it is a non-function property of element objects.

    > You can use an alternative, (like innerHTML) which is also not standard,
    > but supported in most browsers.


    `firstChild.nodeValue' (W3C DOM Level 1+) would probably be a viable
    alternative here. `textContent' (W3C DOM Level 3 Core) is AFAIK supported
    since Gecko 1.7.8 (Firefox 1.5), Opera 9.0.8367, and Safari 3.0.4.


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Sep 10, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    1,401
    Adrienne Boswell
    Jan 10, 2007
  2. JB
    Replies:
    3
    Views:
    125
    Fred Oz
    Nov 7, 2004
  3. Eric-Sebastien Lachance

    Simple <div onclick=""> not working in firefox

    Eric-Sebastien Lachance, Oct 20, 2005, in forum: Javascript
    Replies:
    9
    Views:
    179
    Evertjan.
    Oct 22, 2005
  4. Wiseman
    Replies:
    1
    Views:
    421
    Henry
    Jul 25, 2008
  5. John Ca
    Replies:
    22
    Views:
    216
    Dr J R Stockton
    Oct 7, 2009
Loading...

Share This Page