|
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, "&") ;
> text = text.replace(/"/g, """) ;
> text = text.replace(/</g, "<") ;
> text = text.replace(/>/g, ">") ;
> text = text.replace(/'/g, "'") ;
>
> 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]
|