이벤트 리스너에게 이벤트 객체 전달 받기
본문
<span id="p">마우스 올려봐</span>
<button onclick="f()">클릭</button>
<script type="text/javascript">
document.getElementById("p").onmouseover = f; // id='p'영역에 마우스 오버이면 f함수를 실행
function f(){
alert(event.type); //이벤트.종류 출력
}
</script>
==== tip ====
순서상 <스크립트> 다음에 <p>태그가 오면 실행이 되지 않는다.
추천0 비추천 0
댓글목록 0
등록된 댓글이 없습니다.