By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,497 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,497 IT Pros & Developers. It's quick & easy.

A simple javascript code not working on Firefox

P: n/a
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
Sep 9 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sep 9, 7:37*am, fulio pen <fulio...@yahoo.comwrote:
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.

Sep 9 '08 #2

P: n/a
On Sep 9, 7:49*am, Tom Cole <tco...@gmail.comwrote:
On Sep 9, 7:37*am, fulio pen <fulio...@yahoo.comwrote:
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
Sep 9 '08 #3

P: n/a
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
Sep 10 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.