Re: calling javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Garth Hapgood - Strickland wrote:
by saying ?

echo error_popup();
or
print error_popup;

As someone mentioned, you cannot call a javascript function from within PHP. What is meant by client side/server side is this: PHP is processed on the server before sending any content to the browser; that's server-side. Then, the server sends the HTML output of the PHP script to the browser. Any javascript you have in the output is enacted in the browser (client-side).


So, you want your PHP to output the javascript just like it might output HTML:

i.e.

echo '<script type="text/javascript">';
echo 'function error_popup() { newwin = window.open("error_popup.php","sss","height=470,width=450") }';
echo '</script>';
echo '<input type="button" onclick="error_popup()">';


Sounds to me like you need to go back and revisit the introductory pages of the PHP manual. Take a look at <http://www.php.net/introduction> and follow the subsequent pages to read more about PHP and what it can do. It'll also take you through a tutorial that's fairly helpful.

--
Regards,
Ben Ramsey
http://benramsey.com

---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux