html5 新标签支持js写法

先上代码  用js创建新的标签元素,使ie支持html5新标签

通过Jscript中@cc_on 语句识别IE浏览器及版本的代码

if(!/*@cc_on!@*/0)    IE11一下执行此代码

If your browser doesn't know conditional compilation (other than IE < 11), the expression will be:

if(!0) // ==> TRUE

otherwise it will be:

if(!!0) // ==> FALSE

/*@cc_on @*/
/*@
    document.write("JavaScript version: " + @_jscript_version + ".");
    document.write("
"); @if (@_win32) document.write("Running on the 32-bit version of Windows."); @elif (@_win16) document.write("Running on the 16-bit version of Windows."); @else document.write("Running on a different operating system."); @end @*/

原文地址 https://stackoverflow.com/questions/24473882/what-does-this-comment-cc-on-0-do-inside-an-if-statement-in-javascript



检测浏览器是不是ie的方法

var isIE = !!document.all && document.uniqueID;

var isIE = navigator.userAgent.indexOf("MSIE") > -1;

//from MooTools 1.1.2
if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
else if (document.childNodes && !document.all && !navigator.taintEnabled) window.webkit = window[window.xpath ? 'webkit420' : 'webkit419'] = true;
else if (document.getBoxObjectFor != null || window.mozInnerScreenX != null) window.gecko = true;




















你可能感兴趣的:(javascript)