Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / HTML / July 2008



Tip: Looking for answers? Try searching our database.

replacing innerHTML in xhtml

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Denis McMahon - 28 Jul 2008 09:49 GMT
Hi

A relative has a web page that they want to work with google checkout,
so it has to be xhtml, as the google scripts require xhtml.

However, I wish to replace the text content of an id'd span.

In html 4.01, I could do this with the innerhtml property, but that's
not supported in xhtml.

Any suggestions? I can find examples that show me how to create an
additional textnode and add text to it, but not ones that show me how to
update or replace [the content of] an existing textnode.

Denis McMahon
Martin Honnen - 28 Jul 2008 13:10 GMT
> A relative has a web page that they want to work with google checkout,
> so it has to be xhtml, as the google scripts require xhtml.
[quoted text clipped - 7 lines]
> additional textnode and add text to it, but not ones that show me how to
> update or replace [the content of] an existing textnode.

  document.getElementById('spanId').firstChild.nodeValue = 'foo';

However as long as you serve the XHTML document as text/html it should
be no problem at all to use innerHTML, and even if the XHTML is served
as application/xhtml+xml then browsers like Firefox 1.5 and later
support innerHTML for XHTML elements.

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/

Harlan Messinger - 28 Jul 2008 17:07 GMT
> Hi
>
[quoted text clipped - 5 lines]
> In html 4.01, I could do this with the innerhtml property, but that's
> not supported in xhtml.

It won't be supported anyway, because Javascript is case-sensitive, and
innerhtml doesn't exist. Maybe IE has recognized this in quirks mode.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.