Re: innerHTML and PHP string parsing



Thomas 'PointedEars' Lahn said the following on 4/12/2006 8:23 AM:
endlesstide@xxxxxxxxx wrote:

Is there a PHP command to convert a $string of HTML
into something friendly for innerHTML population?

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.

I get a undtermined string constant error sometimes.

"Doctor, I'm ill sometimes. What did I do wrong?"

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

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.



Relevant Pages

  • Attempt to de-mystify AJAX
    ... A javaScript enabled web browser. ... One of the first things to happen is toward the last in the html code: ... Set the onReadyStateChange handler to our processChange() function ... I like PHP so our example uses php. ...
    (comp.databases.pick)
  • Re: MV by Phone and Cross-Platform MV connectivity
    ... And you believe the operators are going to do their own thing in PHP / ... Javascript & HTML ... where are *any* services set up by Pick hosts. ...
    (comp.databases.pick)
  • Simple Javascript replace (with a twist!) of an href
    ... know this isn't that hard, i'm just a little new to javascript, and I ... so I need to change the href of a link on our php driven auction ... The reason I need to do this is that the html parser used by our ... I have spent hours searching and testing with no luck. ...
    (comp.lang.javascript)
  • Re: Doing a Text comparison
    ... So if a job description has (PHP, JSP, ColdFusion, HTML, Javascript) ... Or someone puts ColdFusion in the description and in the resume there ...
    (comp.lang.java.help)
  • Re: Form to JavaScript.
    ... What the solution to pass html form from PHP to javascript function. ... escapeJS() example, and we'll have a nice discussion about that;-) ...
    (comp.lang.javascript)