JS- 이벤트

Jeongwon·2022년 1월 12일
0

Java Script

목록 보기
2/14

hi라고 적힌 버튼을 클릭하면 경고창이 뜨게 하기

<input type="button" value = "hi">

텍스트 적는 곳에 내용이 바뀌면 경고창이 뜨게 하기

<input type="text">

키보드로 입력을 하면 경고창이 뜨게 하기

<input type="text">

🎃위에 쓰인 onclick, onchange, onkeydown을 이벤트라고 한다.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <input type="button" value = "hi" onclick="alert('경고')">
    <input type="text" onchange="alert('changed')">
    <input type="text" onkeydown="alert('key down!')">
  </body>
</html>
profile
(❁´◡`❁)

0개의 댓글

관련 채용 정보