ie:用绑定
非ie:创建的iframe.onload=函数
当前网页选中的内容 ie:document.selection 其他:window.getSelection() 选中文字
ie:document.selection.createRange().text 其他:window.getSelection().toString()
监听输入框变化
ie6-8:onpropertychange 高级:oninput Ready
ie6-8:创建script,oS.defer=true
高级,ie9:addEventListener(‘DOMContentLoaded’
localStorage ie6,7不兼容
,fn,false) over事件
ie,chrome:oEvent.fromElement; ff,chrome:oEvent.relatedTarget; out事件
ie,chrome:oEvent.toElement; ff,chrome:oEvent.relatedTarget;
鼠标事件:
onmouseenter,onmouseleave仅ie完美支持,ff有问题
控制台日志
console.log ie不支持 鼠标位置
pageX:高级浏览器,ie9 x:ie,chrome layerX:高级。ie9
取消冒泡:
ie:oEvent.cancelBubble=true; 非ie:oEvent.stopPropagation();
Stringify
ie6,7不支持JSON.stringify();
innerText,outerText ff不支持
数组indexOf ie678都不支持 鼠标位置 screenX/screenY
鼠标距离用户屏幕的最上及最左的位置(脱离浏览器) ie6,7,8不支持
pageX:与client一样,区别含滚动距离scroll ie6,7,8不支持
x/y(小写):返回有定位的父级的距离 ie,chrome(不准确)
layerX/layerY:同x/y, ie6,7,8不支持
获取元素:document.all ff不支持
设置/获取元素中的text innerText:chrome,ie支持 textContent: ie6-8不支持
获取元素距离窗口左上角距离(不加滚动):getBoundingClientRect(),ie6-8不支持获取宽,高
Trim(去掉两端空格):ie6-8不支持
Onselectstart开始选中内容事件(input,textarea不支持):ff不支持,ff用-moz-user-select
判断数组:isArray,ie6-8不支持
getComputedStyle:ie6-8不支持
Ie6,7的href,src用getAttribute会返回完全路径, 解决obj.getAttribute(‘src’,2)
获取元素/获取元素集合
querySelector/querySelectorAll,ie6,7不支持
相关推荐: