Last active
August 3, 2017 09:50
-
-
Save Mauryashubham/f32fc10a4838afaf1d7f9b1e46bcf6dc to your computer and use it in GitHub Desktop.
Call a HTML JavaScript Function from PHP using echo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
@author : Shubham Maurya, | |
Email id : [email protected] | |
**/ | |
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment