문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
wiki:javascript:javascript_note:dom_events [2021/04/20 11:48] emblim98 |
wiki:javascript:javascript_note:dom_events [2023/01/13 18:44] (현재) |
||
|---|---|---|---|
| 줄 228: | 줄 228: | ||
| =====More Examples===== | =====More Examples===== | ||
| + | %%onmousedown and onmouseup%%\\ | ||
| + | 사용자가 마우스 버튼을 누르고 있을 때 이미지를 변경합니다.\\ | ||
| + | <code javascript> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <img src=" | ||
| + | < | ||
| + | |||
| + | < | ||
| + | function lighton() { | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | function lightoff() { | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | %%onload%%\\ | ||
| + | 페이지 로딩이 완료되면 alert 상자를 표시합니다.\\ | ||
| + | <code javascript> | ||
| + | < | ||
| + | < | ||
| + | <body onload=" | ||
| + | |||
| + | < | ||
| + | function mymessage() { | ||
| + | alert(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | %%onfocus%%\\ | ||
| + | 포커스를 받으면 입력 필드의 배경색을 변경합니다.\\ | ||
| + | <code javascript> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | Enter your name: <input type=" | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | function myFunction(x) { | ||
| + | x.style.background = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | %%Mouse Events%%\\ | ||
| + | 커서를 요소 위로 이동하면 요소의 색상을 변경합니다.\\ | ||
| + | <code javascript> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | <h1 onmouseover=" | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||