RE: [PHP] Re: Calling a javascript function?
| From: | Kevin Stone | Date: | Fri, 22 Mar 2002 00:12:31 +0000 |
| Subject: | RE: [PHP] Re: Calling a javascript function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89617@lists.php.net to get a copy of this message | ||
In this case you're talking about building the Javascript dynamically.
Example..
-----------------------------------
<html>
<head>
<script language="javascript">
function echoPHPOut(out)
{
document.write(out);
}
</script>
</head>
<?php
$true = true;
if ($true)
{
$out = 'blah blah';
echo "<body onLoad=\"echoPHPOut('$out')\">";
}
?>
</body>
</html>
-----------------------------------
It's a very round about way of printing a string based on a set of
criteria. You could run complex Javascript functions in the same way.
But realize that Javascript only works through the browser.. so whatever
you output from the PHP script must be a full fledged and functioning
Javascript.
-Kevin
-----Original Message-----
From: David Johansen [mailto:daveisfera@yahoo.com]
Sent: Thursday, March 21, 2002 4:55 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Calling a javascript function?
I would want to do something like this:
<?php
if (something true)
{
somejavafunc();
}
?>
I would want to do that. Is there some way of pulling that off? Thanks,
Dave
"Julio Nobrega" <inerte@hotmail.com> wrote in message
news:20020321235222.89091.qmail@pb1.pair.com...
> Maybe not the way you have imagined, but either you do it outside
php
(out
> of <?php ?>) or you echo it.
>
> --
> Julio Nobrega.
>
> Um dia eu chego lá:
> http://sourceforge.net/projects/toca
>
> Ajudei? Salvei? Que tal um presentinho?
>
> http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
> "David Johansen" <daveisfera@yahoo.com> wrote in message
> news:20020321234535.82829.qmail@pb1.pair.com...
> > Is there any way to call a javascript function from inside a php
script?
> > Dave
> >
> >
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php