window.οnlοad=function(){
var box=document.getElementById("box");
function thingstype(ev){
var e=ev||event;
switch(e.type){
case'click':e.target.style.background='blue';break;
case'mouseenter':e.target.style.background='green';break;
case'mouseleave':e.target.style.background='yellow';break;
}
}
box.οnclick=function(){
thingstype();
}
}
好像这么玩 用处不大...