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:[EMAIL PROTECTED]] 
Sent: Thursday, March 21, 2002 4:55 PM
To: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>   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" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to