innerHTML and PHP string parsing

E

endlesstide

Is there a PHP command to convert a $string of HTML into something
friendly for innerHTML population? I get a undtermined string constant
error sometimes.
 
E

Evertjan.

wrote on 12 apr 2006 in comp.lang.javascript:
Is there a PHP command to convert a $string of HTML into something
friendly for innerHTML population? I get a undtermined string constant
error sometimes.

There are no PHP commands in Javascript.

Try another NG.
 
E

Erwin Moller

Is there a PHP command to convert a $string of HTML into something
friendly for innerHTML population? I get a undtermined string constant
error sometimes.

Hi,

If your HTML is not suitable to insert somewhere with innerHTML, try to find
the reason WHAT is causing that.

There is no such thing as 'special innerHTML' encoding.
It is all just html, only retrieved in a different way (via XMLHttpRequest).

I would suggest you try to isolate when this happens, and call the script
that returns the offending html directly.
Then see if you agree with the returned HTML.

It could be a PHP codingmistake, or mayby you are trying to send Javascript
back. (The latter is more difficult, if this is the case: ask again.
Several solutions exists)

Regards,
Erwin Moller
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 4/12/2006 8:23 AM:
You need to escape "</" as "<\/" if PHP generates
script code as content of a HTML `script' element.

That's debatable.
PHP programming is off-topic here.

That is true, but, the implications of what PHP generates to Javascript
executing in the UA *is* on-topic here. And in order to know what to do
in PHP to make it JS friendly then you have to find out what is JS
friendly first. And you find that out - gasp - in a Javascript
newsgroup, not in a PHP group.
"Doctor, I'm ill sometimes. What did I do wrong?"

Umm, you read too many of Thomas' Usenet posts?
 
O

optimistx

Randy Webb said:
Thomas 'PointedEars' Lahn said the following on 4/12/2006 8:23 AM: ....


Umm, you read too many of Thomas' Usenet posts?
:)

'Yes doctor. I love to hate them. Have I an Asperger syndrome?'
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top