You are here: Re: PHP within javascript « PHP Programming Language « IT news, forums, messages
Re: PHP within javascript

Posted by Jeff North on 08/27/07 12:33

On Mon, 27 Aug 2007 02:00:11 -0000, in comp.lang.php
Morlaath@gmail.com
<1188180011.507936.75090@r34g2000hsd.googlegroups.com> wrote:

>| Is there a way to embed php within javascript code? I know that php is
>| server side and js is client side. For instance when working with jsp,
>| you can imbed jsp scriptlets within the js code.
>|
>| e.g
>|
>| <script language="javascript">
>| function foo() {
>| var bar = <%=(java variable)%>
>|
>| <% if (bar == null) { %>
>| alert("Null value");
>| <% } %>
>| }
>| </script>

<script type="text/javascript">
function foo() {
var bar = <?php echo variable;?>

if(bar == null) {
alert("Null value");
}
}
</script>
-- -------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация