function getEvent(){
if(window.event) {return window.event;}func=getEvent.caller;
while(func!=null){
var arg0=func.arguments[0];
if(arg0){
if((arg0.constructor==Event || arg0.constructor ==MouseEvent
|| arg0.constructor==KeyboardEvent)
||(typeof(arg0)=="object" && arg0.preventDefault
&& arg0.stopPropagation)){
return arg0;
}
}
func=func.caller;
}
return null;
}
function cancelBubble()
{
var e=getEvent();
if(window.event){
e.cancelBubble=true;//阻止冒泡 IE浏览器
}else if(e.preventDefault){
e.stopPropagation();//阻止冒泡 非IE
}
}
最后调用cancelBubble()即可