event.srcElement
작성자 : 단국강토
등록날짜 : 2009.02.10 09:48
<form onMouseover="change('yellow')" onMouseout="change('63639C')">
<input type="button" value="Hosting " . .. ... > - 버튼1
<input type="button" value="PSP Tubes " ... ...> - 버튼2
<input type="button" value="Javascripts " ... ...> - 버튼3
</form>
<input type="button" value="Hosting " . .. ... > - 버튼1
<input type="button" value="PSP Tubes " ... ...> - 버튼2
<input type="button" value="Javascripts " ... ...> - 버튼3
</form>
form 자체에 이벤트(event)가 2개 걸려있습니다.
onMouseover, 와 onMouseout... 둘 다 똑같이 change()라는 함수를 호출하게 되어있네요.
그리고, form 안에 3개의 객체가 있습니다.
버튼1, 버튼2, 버튼3 이렇게요.
event.srcElement 는 이 3개의 버튼중 event를 발생시킨 버튼을 말합니다.
change()라는 함수가 호출이 된 바로 그 event의 소스요소(source Element)를 말하는거죠.
즉, 버튼1 위로 마우스가 올라가게 되면(onMouseover) 버튼1이 event.srcElement 가 되는거죠. 물론 onMouseout 했을 경우도 마찬가지고요.
[출처] 웹디황용
"쇼핑몰·홈페이지·오픈마켓
블로그·페이스북·이메일 등의 각종 마케팅 글쓰기, 각종 광고, 영업, 판매, 제안서, 전단지 반응율 3배×10배 이상 높이는 마법의 8단계 공식" |
☞자세히보기 |
|
|