一、用Echarts图表发送ajax

    要加入   crossDomain: true == !(document.all)  代码兼容IE9以下(可以正常请求到数据)

\"\"

二、判断是否为IE浏览器

var isIE = function(obj){
    var b = document.createElement(\'b\');
    b.innerHTML = \"<!--[if IE \"+ obj + \"]><i></i><![endif]-->\"
    return b.getElementsByTagName(\'i\').length === 1
}
var ie = isIE();
var realH = $(\'.cockbtdct\').height() * 0.96;
var allHeight = $(\'.cockbtdlt\').height();
if(ie){
  console.log(\'是IE\')
}else{
}

三、CSS3的rgba兼容到IE9,向下兼容的解决办法

filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#66ffffff,endColorstr=#66ffffff);\"\"

四、input的placehloder的兼容问题

<div class=\"user-input inputConetent\">
         <input type=\"text\" placeholder=\"请输入登录账号\" / id=\"user\">
</div>

function placeholderSupport() {
        return \'placeholder\' in document.createElement(\'input\');
    }

//判断是否支持placehloder属性
    if(!placeholderSupport()){
        
        $(\"[placeholder]\").each(function(){
            var _this = $(this);
            var left = _this.css(\"padding-left\");
            _this.parent().append(\'<span class=\"placeholder\" data-type=\"placeholder\" style=\"position:absolute;top:0;left: 60px;color:#fff;line-height:55px;\">\' + _this.attr(\"placeholder\") + \'</span>\');
            if(_this.val() != \"\"){
                _this.parent().find(\"span.placeholder\").hide();
            }
            else{
                _this.parent().find(\"span.placeholder\").show();
            }
        }).on(\"focus\", function(){
            $(this).parent().find(\"span.placeholder\").hide();
        }).on(\"blur\", function(){
            var _this = $(this);
            if(_this.val() != \"\"){
                _this.parent().find(\"span.placeholder\").hide();
            }
            else{
                _this.parent().find(\"span.placeholder\").show();
            }
        });
        // 点击表示placeholder的标签相当于触发input
        $(\"span.placeholder\").on(\"click\", function(){
            $(this).hide();
            $(this).siblings(\"[placeholder]\").trigger(\"click\");
            $(this).siblings(\"[placeholder]\").trigger(\"focus\");
        });
    }

刷新的时候会有点bug   所以监听刷新事件把input清空

  =\"checkLeave()\"   写在body上

function checkLeave(){
     $(\'input\').val(\'\')
 }

 

收藏 打印