Unicode characters in JavaScript files

E

eggie5

I have a custom object named #cdata-section, however I am unable to
access this object and get a run time "Illegal Character" javascript
error. my object looks like this:

data.news.story.body.#cdata-section

The pound sign is causing problems. How can I use this object in my
javascript source? Right now I'm trying something like this to escape
the pound sign:

summaryNode.appendChild(document.createTextNode(data.news.story.body.\u0023cdata-section));

however, that doesn't work, any ideas?
 
A

Andrew Poulos

I have a custom object named #cdata-section, however I am unable to
access this object and get a run time "Illegal Character" javascript
error. my object looks like this:

data.news.story.body.#cdata-section

The pound sign is causing problems. How can I use this object in my
javascript source? Right now I'm trying something like this to escape
the pound sign:

summaryNode.appendChild(document.createTextNode(data.news.story.body.\u0023cdata-section));

however, that doesn't work, any ideas?


What about trying:

data.news.story.body["#cdata-section"]


Andrew Poulos
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
oglegroups.com>, Tue, 2 Jan 2007 19:23:37, "(e-mail address removed)"
I have a custom object named #cdata-section, however I am unable to
access this object and get a run time "Illegal Character" javascript
error. my object looks like this:

data.news.story.body.#cdata-section

The pound sign is causing problems. How can I use this object in my
javascript source?


FAQ 4.25, FAQ 4.39, & cited Notes.

It's a good idea to read the newsgroup and its FAQ. See below.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top