On Wed, 06 Oct 2004 18:01:51 GMT, User Axes Dean Eyed
<Re**************@Assimilated.B.org> wrote:
The following statement does not yield what I expect it to:
var txtNode = document.createTextNode("ESI−");
txtNode holds a value of "ESI−" instead of "ESI-" where '-' is the
character entity reference for the minus sign, that I expect.
This is discussed in the Specification:
<URL:http://www.w3.org/TR/DOM-Level-2-Core/introduction.html#ID-E7C30824>
As the extended intefaces mentioned in that section are directed at XML
documents, I don't think it's possible to include an entity reference in
the way you want. Your best bet is to look up the numeric values of the
entities (<URL:http://www.w3.org/TR/html4/sgml/entities.html>) and use
JavaScript string escape sequences. Numeric codes below 255 can be
specifed in hexadecimal using \xNN. Other characters must use the Unicode
hexadecimal sequence, \uNNNN. These are provided in the reference above
within the entity comments (look for U+NNNN). Your code above would be:
var txtNode = document.createTextNode("ESI\u2212");
[snip]
Hope that helps,
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.