Re: calling javascript

From: Date: Mon, 01 Nov 2004 14:34:46 +0000
Subject: Re: calling javascript
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-200833@lists.php.net to get a copy of this message
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. ---------------------------------------------------

« previous php.general (#200833) next »