Re: How can I use php codes in javascript?

From: Date: Thu, 20 Jun 2002 01:21:51 +0000
Subject: Re: How can I use php codes in javascript?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-103058@lists.php.net to get a copy of this message
yes but, I am trying to use a php code(so I wrote simply an echo function as test) in javascript. My sample function I sent is just test, "Chris Shiflett" <shiflett@php.net> wrote in message news:3D112B6D.1000404@php.net... > 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: > >> > >> > >> > >>>hi, > >>> > >>>I want to use php codes in a java function. Could you help me please. > >>> > >>> > >How > > > > > >>>can I do this? is this possible? if it is, is there any example about > >>> > >>> > >this > > > > > >>>on the Internet? > >>> > >>>thank you very much. > >>> > >>> > >>> > >>> > > > > > > > > > > > >

« previous php.general (#103058) next »