Skip to Content
자바스크립트 완벽 가이드
book

자바스크립트 완벽 가이드

by David Flanagan, Han Seon- yong
February 2022
Beginner to intermediate
784 pages
24h 53m
Korean
Insight
Content preview from 자바스크립트 완벽 가이드
the De󼴩nitive Guide
489
15.2 이벤트
// Window
객체의
onload
프로퍼티를
함수로
설정합니다
.
//
이
함수가
이벤트
핸들러이며
문서를
불러올
때
호출됩니다
.
window.onload
=
function() {
// <form>
요소를
찾습니다
.
let form
=
document.querySelector("form#shipping");
//
폼을
전송하기
전에
호출될
이벤트
핸들러
함수를
등록합니다
.
// isFormValid()
는
다른
곳에서
정의했다고
가정합니다
.
form.onsubmit
=
function(event) { //
사용자가
폼을
전송할
때
if (!isFormValid(this)) { //
폼
입력이
유효한지
체크합니다
.
event.preventDefault(); //
유효하지
않다면
폼
제출을
막습니다
.
}
};
};
이벤트 핸들러 프로퍼티의 단점은 이벤트 대상이 이벤트 타입 하나당 최대 한 개의
핸들러만 받는다는 가정하에 설계됐다는 점입니다.
addEventListener()
는 이전에
등록한 핸들러를 덮어 쓰지 않으므로 일반적으로
addEventListener()
를 사용해 이
벤트 핸들러를 등록하는 게 더 좋습니다.
󻱃󻅳󼞇󽴔󼩇󺦳󺲻󽴔󻙜󻘀󽴔󻗳󻳤
요소의 이벤트 핸들러 프로퍼티는 대응하는 HTML 태그의 속성으로 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

개발자를 위한 필수 수학

개발자를 위한 필수 수학

토머스 닐드
개발 7년차, 매니저 1일차

개발 7년차, 매니저 1일차

권원상, 한민주, 카미유 푸르니에

Publisher Resources

ISBN: 9788966263462