日期:2014-05-16  浏览次数:20408 次

javascript 阻止事件元素默认行为和传播(冒泡)
document.getElementById('id').onclick = function(e){
	e = e || window.event;
	var target = e.target || e.srcElement;

	// do something

	//prevent default action
	if(typeof e.preventDefault === 'function'){
		e.preventDefault();
		e.stopPropagation();
	}else{
		e.returnValue = false;
		e.cancelBubble = true;
	}
}