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

Where do we use get and post?

533


How to fix "headers already sent" error in php

548


What is a query in php?

478


What is the differences between $a != $B and $a !== $B?

536


What is the difference between static and dynamic websites?

510






Explain the differences between get and post methods?

502


What is the string concatenation operator in php?

527


How to find datatype of variable in php?

535


What is the difference between php and core php?

495


What is the use of header() function in PHP? What the Limitation of HEADER()?

575


How can we increase execution time of a php script?

491


How to convert a character to an ascii value?

564


Which of the delimiter is ASP style?

631


What is the purpose of the '.frm' file extension? What do thes file contain?

515


Is python better than php?

509