How can you insert javascript in php code?

Answer Posted / webguy

Mukesh(watch out for syntax errors) and atanu are right.
VIvek seemed have misunderstood the question. It's more of
injecting JS code within PHP code segment like this:

<?php
echo "<script type='text/javascript'>";
echo "alert('jams bond');";
echo "</script>";
?>

OR

<?php
echo "<script type='text/javascript'>alert('jams
bond');</script>";
?>

Is This Answer Correct ?    24 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I make a script that can be bilingual (supports english, german)?

584


Tell me how to find current date and time?

539


Can php use gettext?

557


What is an associative array?

553


Give the case where we can use get and we can use post methods?

557






What does the function get_magic_quotes_gpc() means?

501


What is mysqli_query?

509


Explain how can php and javascript interact?

540


What is the correct line to use within the php.ini file, to specify that 128mb would be the maximum amount of memory that a script may use?

568


How To Get the Uploaded File Information in the Receiving Script?

584


How would you determine the size of a file in php?

589


Why do we need session?

533


Can php replace javascript?

531


Which php framework is best for web development?

494


What is difference between action hook and filter hook?

489