兼容
lihefei_coder
这个作者很懒,什么都没留下…
展开
-
IE8- bind() 函数兼容
if(!Function.prototype.bind){ Function.prototype.bind = function(){ if(typeof this !== 'function'){ throw new TypeError('Function.prototype.bind - what is trying to be bound is not ca原创 2017-02-21 16:46:39 · 1058 阅读 · 0 评论 -
禁用按键F5刷新,兼容chrome、firefox、IE
低版本按键事件window.onload = function(){ var timer = null; //声明定时器变量 document.onkeydown = function(event){ clearTimeout(timer); //每次按键先清除定时器,避免定时器重复多开 var event = event || window.even原创 2017-02-21 11:13:58 · 2740 阅读 · 0 评论 -
JavaScript 获取计算后的样式
W3C标准浏览器的获取方法:var oDiv = document.getElementById('div');//获取计算后的font-sizevar sFs = getComputedStyle(oDiv,null).getPropertyValue('font-size');//推荐使用//或者var sFs= getComputedStyle(oDiv,null).fontSize;原创 2017-03-13 00:23:31 · 2840 阅读 · 0 评论 -
兼容IE8 addEventListener、removeEventListener 函数
//兼容bind函数if(!Function.prototype.bind){ Function.prototype.bind = function(){ if(typeof this !== 'function'){ throw new TypeError('Function.prototype.bind - what is trying to be boun原创 2017-06-16 16:38:54 · 8563 阅读 · 2 评论 -
IE9兼容maxlength属性
textarea maxlength="10" onchange="this.value=this.value.substring(0, 10)" onkeydown="this.value=this.value.substring(0, 10)" onkeyup="this.value=this.value.substring(0, 10)" >textarea>原创 2018-01-17 18:31:46 · 890 阅读 · 0 评论 -
JavaScript事件绑定、事件解除、DOM加载完成,兼容IE8+
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Examples</title> <meta name="description" content=""> <meta原创 2018-03-26 19:19:05 · 1280 阅读 · 0 评论 -
ajax兼容IE9浏览器
服务器需要关闭跨域访问限制,ajax请求时需要配置 crossDomain项$.ajax({ type: 'post', url: 'http://172.16.4.244:8888/api/list', data: { page: 1 }, crossDomain: true == !(document.all), //这句是关键 ...原创 2018-09-05 11:23:37 · 2154 阅读 · 0 评论