<body>
<input type="button" id="target" value="button" />
<script>
var t = document.getElementById('target');
t.addEventListener('click', function(event){ //function 이하부분이 clikc이라는 이름의 이벤트로 t라는객체에 들어감
alert('Hello world, '+event.target.value); //event.target.value 가 결국 buttion 이된다.
});
</script>
</body>
'오락기 > js' 카테고리의 다른 글
prevent event (0) | 2017.04.18 |
---|---|
event capturing bubbling (0) | 2017.04.18 |
property event (0) | 2017.04.18 |
inline event (0) | 2017.04.18 |
jQuery node (0) | 2017.04.18 |