在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使用
未完待更新
随时随地看视频