or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
EVENT 事件
tags:
Js
target
Event 介面表示了一個在 DOM 物件上所發生的事件。
可以是由使用者的操作行為所產生(如:點擊滑鼠按鈕或敲打鍵盤)
或是來自 API 因處理非同步任務所產生。
註冊監聽事件 (addEventListener)
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →告訴你當下元素資訊 (event 的 e)
當監聽的事件發生時,瀏覽器會去執行我們透過 addEventListener() 註冊的 Event Handler (EventListener) ,也就是我們所指定的 function。
這個時候,EventListener 會去建立一個「事件物件」 (Event Object),裡面包含了所有與這個事件有關的屬性,並且以「參數」的形式傳給我們的 Event Handler:
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →像是
瞭解目前DOM的HTML位置 (nodeName)
取消默認 (preventDefault)
了解目前所在元素位置 (target)
e.target 搭配 nodeName 節點,抓到你預期要做的事情