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.