在IE6/7/8下
Object.prototype.toString.apply(null) 返回"[object Object]" Object.prototype.toString.apply(undefined) 同样返回"[object Object]"
2.IE8以下 JSON是不存在的
解决方法
var str = '{"a":100}'// 1. JSON.parse : 将JSON格式的字符串转成JSON格式的对象 /*var o = JSON.parse(str); o.a=200;//{"a":200} console.log(o.a); console.log(JSON);*/ //在IE8以下,JSON是不存在的 console.log(eval("("+str+")"))
3.获取上一个哥哥元素节点,兼容所有浏览器
function getBrother(curEle) { var pre = curEle.previousSibling; while(pre) { if(pre.nodeType===1){ return pre; } pre = pre.previousSibling; // pre等于哥哥节点的哥哥节点; } }
4.bind传参的方式和call方法一样; IE8以下不兼容
5.低版本ie获取可视区域宽高
var winW=document.body.clientWidth var winH=document.body.clientHeight
6.兼容浏览器获取可视区域的方法
document.documentElement.clientWidth||docuemnt.body.clientWidth document.documentElement.clientHeight||docuemnt.body.clientHeight
Ie8以下不兼容,window中没有getComputedStyle这个方法
//解决方法元素.currentStyle.属性名 //兼容IE所有浏览器//只能Ie使用
未完待更新
點擊查看更多內(nèi)容
1人點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦