Method: 1. Use it in the event attribute of the tag, the syntax "
"; 2. Write it in the script tag pair, the syntax "" statement.
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.
The usage of js is similar to css:
1. Inline
Use "";
<body onload="alert('hello world3')";> </body>
#2. Embedded
Use script tag directly<script> alert("hello world2"); </script>
3. Linked
Use