javascript

/**
@author : Shubham Maurya,
Email id : maurya.shubham5@gmail.com
**/

Hi all , Welcome to shubhammaurya.com , Today we are going to discuss ,
How to Call a JavaScript Function from PHP using echo

1.Make a file in notepad and save it as index.php and paste the below code.

/**
@author : Shubham Maurya,
Email id : maurya.shubham5@gmail.com
**/

Hi all , Welcome to shubhammaurya.com , Today we are going to discuss ,
how to Call HTML JavaScript Function from PHP using echo

1.Make a file in notepad and save it as index.php and paste the below code.

<?php
echo "<script> window.onload = function() {move();}; </script>";
?>
<!DOCTYPE html>
<html>
<head>
  <style>
#myProgress {
  width: 100%;
  background-color: #ddd;
}
#myBar {
  width: 10%;
  height: 5px;
  background-color: #4CAF50;
  text-align: center;
  line-height: 30px;
  color: white;
}
</style>
</head>


<body>
  
<p id='myP'></p>
 
<script>
function move() { 
      document.getElementById("myP").innerHTML = "Successfully Invoked.";
}
</script>

</body>
</html>
</html>

Find Code at github : click here
STAY CONNECTED FOR MORE

By jackmaurya121

Hi , My Name is Shubham Maurya and i am currently working as a Project Manager.

3 thoughts on “Call a JavaScript Function from PHP using echo”

Leave a Reply