simple bellow Example display results using the call javascript function from html Calling a function using Pure js and here how to use php in javascript? β Example | php code in javascript.
index.html
<html> <head> <script type = "text/javascript"> function myfunction() { alert("Welcome to Pakainfo.com"); } </script> </head> <body> <p>here simple Click the following Display button to see the javascript function in see action</p> <input type = "button" onclick = "myfunction()" value = "Display"> </body> </html>
Also Read: how to call javascript function in html & JavaScript Define
call javascript function from html
Answer to: “call javascript function from html” simple you can Just call it from a script tag:
<script> JavaScript: function getWebsiteInfo(a) { console.log(`Welcome ${a}!`); }; </script>
<marquee> Welcome! <script>getWebsiteInfo(Pakainfo);</script> <!-- Returns: "Welcome Pakainfo!" --> </marquee>