Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] createTextNode and special characters
- From: javascript@xxxxxxxxxx (J. Lester Novros II)
- Subject: [Javascript] createTextNode and special characters
- Date: Sun, 26 May 2002 03:09:45 +0200
Dear Normann,
On 05/24/2002 03:33 PM, Immanuel Normann wrote:
> I want to create dynamically text with special characters like ä
> Therefore I want to use document.createTextNode('ä');
Ah, took me a while to figure that one out. 'createTextNode' does exactly what
it says, it creates a *text* node. The '&foo;' notation, however, is an HTML
construct and is not interpreted as such in a text node. What you want is the
'innerHTML' property of the node, like this:
var t = document.createElement('div');
t.innerHTML = 'ä';
document.body.appendChild(t);
Then, the '&foo;' construct *is* interpreted as HTML which will yield the
desired result.
l8R lES
--
Sharing information with competitors can damage national security. [...] Some m$
code is so flawed it cannot be safely disclosed.
m$ vice president Jim Allchin in Federal Court testimony
http://open.denhaag.nu http://www.denhaag.org
- Follow-Ups:
- [Javascript] createTextNode and special characters
- From: Immanuel Normann
- [Javascript] nested "for" statements
- From: Bill Marriott
- [Javascript] createTextNode and special characters
- References:
- [Javascript] createTextNode and special characters
- From: Immanuel Normann
- [Javascript] createTextNode and special characters
- Prev by Date: [Javascript] Status Bar Problems (Ignore Previous One)
- Next by Date: [Javascript] createTextNode and special characters
- Previous by thread: [Javascript] createTextNode and special characters
- Next by thread: [Javascript] createTextNode and special characters
- Index(es):