1 inline event registration
1.1 direct write function within the line
<div class="box" onclick="{alert(245)}"><div>
Call the function has been written within the line 1.2 or
<div class="box" onclick="fun()"><div>
<script>
function fun(){
alert(234);
}
</script>
2 event registration page
// html 页面
<body>
<div class="box"></div>
</body>
// js结构
<script>
var div = document.querySelector('.box');
div.addEventListener('click', function() {
alert('hello world');
})
</script>
3 js introduced outside to achieve registration
// 引入外部的js
<script src="./js/unimportant.js"></script>