You are here: Re: <? print .. DIV> + InnerHTML question, thank you « All PHP « IT news, forums, messages
Re: <? print .. DIV> + InnerHTML question, thank you

Posted by Sιverin Richard on 08/25/07 20:46

You have to be very carefull concening ',", and htmlentities...

use evry times EXEACTLY the same syntax. Espacially if $someblog[0] may
be modified by the user.

Moreover, i dont like your: '<? .

You may write something like:
<script>
<?
echo "document.getElementById('somewhere').innerHTML = '".
ereg_replace( "'","\\'",$someblog[0] ) .
"';";
?>
</script>

carriage returns and dblquote(") will be OK.

for single quote(') the right syntax may be:
ereg_replace( "'","\'",$someblog[0] )
or ereg_replace( "'","\\'",$someblog[0] )
or ereg_replace( "'","\\\'",$someblog[0] )

try all of this.
good luck;



encepif@gmail.com wrote:
> Hopefully someone can give me definitive answer:
>
> What steps can I take to do this process, so no breakdowns in
> presentation occurs when I use,
>
> <script>
> document.getElementById("somewhere").innerHTML = '<?print
> $someblog[0];?>'
> </script>
>
> <div id=somewhere></div>
>
> So, someblog[0] might have weird characters, un-escaped whatevers,
> that clog of the div presentation. I am not sure what to catch or
> what converters to use. What are basic considerations & science do I
> need to apply to the string prior to presentation in the div? :-)
>
> Thank you for assistance. Have a good day.
>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация