var stopObj = { 'stopEvent': function () { //stopPropagation阻止事件传递至下一个节点 if (event.stopPropagation) { //非IE浏览器 event.stopPropagation(); } else { //IE cancelBubble阻止事件冒泡 event.cancelBubble = true; } }, 'cancleDefault': function () { if (event.preventDefault) { //非IE浏览器 取消节点默认行为 event.preventDefault(); } else { //IE 取消节点默认行为 event.returnValue = false; } } };
JS event 兼容性写法
最新推荐文章于 2021-04-06 11:48:02 发布