From: FAQ server on
-----------------------------------------------------------------------
FAQ Topic - How do I get a jsp/php variable into
client-side javascript?
-----------------------------------------------------------------------

Use the server-side language to generate the javascript:

// JSP
var jsvar = "${ jspVar }";
// PHP
var jsvar = "<?php echo $phpVar ?>";

If the string contains a quote mark, it will have to be escaped.
If the an inline-script tag is used, and the string must not
contains characters such as ` < `, ` > `, ` & `.


The complete comp.lang.javascript FAQ is at
http://jibbering.com/faq/

--

The sendings of these daily posts are proficiently hosted
by http://www.pair.com.