Reply to Re: Storing a javascript variable in a php string

Your name:

Reply:


Posted by Rich on 07/07/06 20:33

On Fri, 07 Jul 2006 09:15:33 +0200, Markus Schuster wrote...
>
>Hi,
>
>I have the following javascript function:
>
><script type="text/javascript">
>
>function HTMLEncode( text )
>{
> text = text.replace(/&/g, "&amp;") ;
> text = text.replace(/"/g, "&quot;") ;
> text = text.replace(/</g, "&lt;") ;
> text = text.replace(/>/g, "&gt;") ;
> text = text.replace(/'/g, "&#39;") ;
>
> return text ;
>}
>
></script>
>
>Now I want to store the content of 'text' in a php string.
>Is that possible?
>
>Thanks, Max



If the javascript code doesn't need to be dynamic, it may not be worth the
headache trying to use PHP to output it. If you are just trying to clean up the
HTML document, maybe put the functions into a separate file and use one line to
load it.

<head>
<script src="myfunctions.js"></script>
</head>


If the javascript code was intended to be dynamic, you can treat the text as you
would the rest of your HTML document, insert your PHP code where needed.

Rich
--
Newsguy's Basic Account / $39.95 - 12 months
More info - http://newsguy.com/overview.htm

[Back to original 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация