1. Tag <script>
The common method used is to write it in tags <script>. Tags <script>can be made in tags <head>, whatever in tags <body>. Example:
2. External Files
Besides onclick events there are also other events , such as onsubmit , onload , ondoubleclick , onmouseover , onmouseout, etc.
Then, how do we use this method in HTML?