it's about actions that happen inside the browser.

onclick(點擊), onmouseover(hover) e onmouseout(移走)

HTML:
    
    <button id="click-me">Click here</button>
    <button id="hover-me">Move the cursor over here</button>
    <button id="leave-me">Move the cursor out of here</button>
Javascript:
    
    document.getElementById("click-me").onclick = function() {
        alert('You clicked the button');
    };

    document.getElementById("hover-me").onmouseover = function() {
        alert('You moved the cursor over the button');
    };

    document.getElementById("leave-me").onmouseout = function() {
        alert('You moved the cursor out of the button');
    };

onkeydown(鍵盤事件)

document.onkeydown = function() {
        alert('You pressed a key');
    };

specific key(keyCode)

he keyCode property returns the Unicode of the pressed key.

針對指定按鍵做偵測

document.onkeydown = function (event) {
  if (event.keyCode == "65") {
    alert("Do something if letter 'a' is pressed.");
  }
};

Event manipulation(操作) via html attribute

using HTML attributes:

<button onclick="show_alert()">Click here</button>
function show_alert() {
        alert('You clicked the button');
    }