//判断该浏览器是否为w3c标准,既非IE浏览器 if(window.navigator.userAgent.indexOf("Firefox") >= 1){ //获取事件 }else if(window.navigator.userAgent.indexOf("MSIE") >= 1){ //ie浏览器 var version=window.navigator.userAgent; //<!--IE7--> if(navigator.appVersion.match(/7./i)=='7.'){ $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" />"); } //<!--IE8--> if(navigator.appVersion.match(/8./i)=='8.'){ $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE8\" />"); alert("ie8"); } if(navigator.appVersion.match(/9./i)=='9.'){ $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE9\" />"); alert("ie9"); } }