Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > A simple javascript code not working on Firefox

Reply
Thread Tools

A simple javascript code not working on Firefox

 
 
fulio pen
Guest
Posts: n/a
 
      09-09-2008
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
 
Reply With Quote
 
 
 
 
Tom Cole
Guest
Posts: n/a
 
      09-09-2008
On Sep 9, 7:37*am, fulio pen <fulio...@yahoo.com> 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.

 
Reply With Quote
 
 
 
 
fulio pen
Guest
Posts: n/a
 
      09-09-2008
On Sep 9, 7:49*am, Tom Cole <tco...@gmail.com> wrote:
> On Sep 9, 7:37*am, fulio pen <fulio...@yahoo.com> 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
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      09-10-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple, simple debug not working Jacob N. Ruby 0 12-29-2010 09:04 PM
Javascript code working with Firefox but not with IE... please help! John Ca Javascript 22 10-07-2009 04:11 PM
Help: Javascript not working in Firefox "event not defined" Wiseman Javascript 1 07-25-2008 03:04 PM
Simple <div onclick=""> not working in firefox Eric-Sebastien Lachance Javascript 9 10-22-2005 07:44 AM
simple javascript not working?!?!? Daniel Bass ASP .Net 1 07-07-2003 02:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57