Re: How can I use php codes in javascript?
| From: | Chris Shiflett | Date: | Thu, 20 Jun 2002 01:10:05 +0000 |
| Subject: | Re: How can I use php codes in javascript? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103056@lists.php.net to get a copy of this message | ||
I'm assuming you mean to say that your code snippet below is output in between HTML script tags.
If so, your javascript would then look like this:
function sil() {
sss
}
Now does the error make sense?
Chris
Burak Delice wrote:
thanks Justin, but below function gave an error as "syntax error" function sil() { <? echo("sss"); ?> } "Justin French" <justin@indent.com.au> wrote in message news:B9376505.8F41%justin@indent.com.au...Well, it depends what you want to achieve. eg: --- <? $myvar = "foo"; ?> <A HREF="javascript:alert('<?=$myvar?>');">click</a> --- works fine. remember, PHP is parsed on the server (before anything it's sent to the browser), and javascript is parsed on the client side (browser). Justin French on 20/06/02 10:50 AM, Burak Delice (bdelice@abt.com.tr) wrote:Howhi, I want to use php codes in a java function. Could you help me please.thiscan I do this? is this possible? if it is, is there any example abouton the Internet? thank you very much.