// 一个函数处理同个元素的多个事件
var oBtn=document.querySelector('#btn');
oBtn.onclick=handler;
oBtn.onmouseover=handler;
oBtn.onmouseout=handler;
function handler(event) {
switch(event.type){
case 'click': alert('click');break;
case 'mouseover': alert('mouseover');break;
case 'mouseout': alert('mouseout');break;
}
}