Please dont mix your languages, php and javascript are two different languages that run on two different levels, js is client-side (yes i know you can run it server side, but for the sake of this argument), and php is server side. php doesnt parse javascript code and vise-versa... so please dont include a JS file in php... it wont do you any good. On Fri, Apr 1, 2011 at 5:07 PM, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx>wrote: > I have this code in my php script. A simple page to test out a function > that I learned from a book I bought. > > <?php > $root = $_SERVER['DOCUMENT_ROOT']; > include($root.'/../php/inc/js/getText.js'); > ?> > > </head> > > > The include gets a function I wrote called getText and I have dumped the > source code of my webpage after I get the error and i see that the include > did in fact work. There is a function with that name. Here is the header > > <script type="text/javascript"> > function getText(e) > { > . > > . > > .} > </script> > </head> > > > In the body of my html doc built by this script I have the following lines: > > echo 'para contains: '; > echo getText("p1"); **** > echo '<br><br>'; > echo 'heaading contains: '.getText("h2"); > ?> > </body> > > > I get this output on the line containing the **** > > para contains: > Fatal error: Call to undefined function getText() in > /home/albany/public_html/players_dir/test_gettext.php on line 23 > > > As you can see my output starts out as I expect but then I get the > undefined > function message. > > What am I not doing correctly? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >