A simple javascript code not working on Firefox

F

fulio pen

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
 
T

Tom Cole

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.
 
F

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
 
T

Thomas 'PointedEars' Lahn

Tom said:
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top