Re: Re: PHP files in the SRC attribute of an SCRIPT element
| From: | Jason Gerfen | Date: | Fri, 17 Mar 2006 15:54:06 +0000 |
| Subject: | Re: Re: PHP files in the SRC attribute of an SCRIPT element | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232133@lists.php.net to get a copy of this message | ||
You will want to write PHP code to output the java-script. Because the java-script (client side scripting) gets executed without communicating with the server there is no PHP engine that java-script can push the PHP through on the client machine.
So you would want to do something like:
<?PHP
$string = "I want a new pop-up message";
$javascript = "<script>alert( $string )</script>";
echo $javascript;
?>
Karl-Heinz Christian Zeck wrote:
Thank you for your quick reply. I tried to modify the file. I removed all it's content and wrote only a single line: alert("test"); When I refresh the main page, I get the alert message - this means the file was loaded successfuly. Then I tried this code: alert("<?php echo 'test';?>"); This way it doesn't work, no alert message, so the file wasn't loaded. Any ideas? Thanks! On 3/17/06, Barry <barry@flyerheaven.de> wrote:-- Jason Gerfen Student Computing Labs, University Of Utah jason.gerfen@scl.utah.edu J. Willard Marriott Library 295 S 1500 E, Salt Lake City, UT 84112-0860 801-585-9810 "You will never be ready for me." ~ MeKarl-Heinz Christian Zeck wrote:Hi everybody,engineAre you allowed to do this? I mean, is the php file parsed by the PHPfirst and a js code is generated that will be used by the script element?Yes -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php