Search

10/02/2007

javascript idiom: stopPropagation+preventDefault vs. cancelBubble+returnValue

if (event.stopPropagation) event.stopPropagation( ); // DOM Level 2
else event.cancelBubble = true; //IE

// prevent default action
if (event.preventDefault) event.preventDefault( ); // DOM Level 2
else event.returnValue = false; // IE

沒有留言: