[Javascript] createTextNode and special characters

Immanuel Normann normann at dfki.de
Fri May 24 08:33:18 CDT 2002


Hello,

I want to create dynamically text with special characters like ä
Therefore I want to use document.createTextNode('ä');

The following code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
<script type="text/javascript">
function showUml() {
 var t = document.createTextNode('&auml;');
 document.body.appendChild(t);
}
</script>
  </head>
  <body onload='showUml()'>&auml;
  </body>
</html>


should give me the respectiv single symbol onload, but what I see in my 
browser (Mozilla 1.0 rc2) is actually the 8-character long text: '&auml;'

How could I change this?
(document.createTextNode('&#252;'); doesn't help
document.createEntityReference('&#252;'); yields an javascript error)

Thanks for help,

Normann




More information about the Javascript mailing list