Prev: Opening Link in a frame
Next: FAQ Topic - How do I log-out a user when they leave my site? (2010-03-04)
From: FAQ server on 2 Mar 2010 19:00 ----------------------------------------------------------------------- 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. |