Can I include Javascript in my PHP code?
Simply use the echo or print statement to do so, as you would with normal text or HTML that you are outputting to the screen.
Here's an example of this in action:
<?php
echo "<script language=\"JavaScript\">";
echo "alert("PHP can write JavaScript you know!");";
echo "</script>";
?>
Comment on this Question and Answer >>>
ASK A QUESTION
More other PHP Questions
How do you get an array of the date and time?What is a constant in PHP?
How do I add comments to my PHP script?
How do I check if a date entered exists?
What are autoglobals?
