How to call a function with onclick event in JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
    <head>   
        <script>
            function f() {
                document.write("function f()");
            }
        </script>      
    </head>

    <body>   
        <input type = "button" onclick = "f()" value = "Click Here" />
    </body>
</html>



<!--

run:

function f()

-->

 



answered Feb 26, 2020 by avibootz
...