<!--[if IE]>
document.createElement("header"); // 创建 header 节点
document.createElement("footer"); document.createElement("nav");
document.createElement("article"); document.createElement("section");
<![endif]-->
<!--[if IE]>
(function(){if(!/*@cc_on!@*/0)return;var e =
"abbr,article,aside,audio,bb,canvas,
datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav
,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i]
)}})()
<![endif]-->
<!- – [if It IE 9]-->
<script src="
http://html5shiv.googlecode.com/svn/trunk/html5.js "></script>
模式窗口很像一个标准的对话框。模式窗口会屏蔽主窗口,直到将其关闭。其基本语法为:
window.showModalDialog( 对话框 URL ,参数,特征 )
对话框 URL :指要显示的文档的 URL 地址; 参数:指要传递给模式对话框的对象或值;
<!-- window.showModalDialog("index.htm", window,
"dialogHeight:150px;dialogWidth:300px;center:yes;help:no;resizable:no;status:no;");
//-->
无模式窗口与模式窗口完全不同。模式窗口永远停留在原窗口的上层,即使原窗口获得焦点,仍然如此。通常用无模式窗口显示帮助信息或其它上下文相关信息。其基本语法结构为:
<!-- window = window.showModalDialog("index.htm", window,
"dialogHeight:150px;dialogWidth:300px;center:yes;help:no;resizable:no;status:no;");
//-->
方法即可。该方法用于弹出网页(模式)对话框。 语法格式如下:
variant=window.showModalDialog(sURL[,vArguments[,sFeatures]])
下注册多个事件监听器与移除监听器。 IE 浏览器中, HTML 元素有个 attachEvent 方法,允许外界注册该元素多个事件监听器,例如。
element.attachEvent('onclick', observer);
注意 在 IE 7 中注册多个事件时,后加入的函数先被调用。 如果要移除先前注册的事件监听器,调用 element 的 detachEvent 方法即可,参数相同,例如。
element.detachEvent('onclick', observer);
if (!+[1]) {
//IE 11 不支持
alert(' 这是 IE 浏览器 ');
} else {
alert(' 这不是IE 浏览器 ');
}
非 IE 浏览器下将类数组对象" arguments "转为数组:
Array.prototype.slice.call(arguments);
arguments 不是 Array的实例,因此不是真正的数组,也就没有 slice() ,那为什么使用" Array.prototype.slice "而不是" Array().slice "或" [].slice"呢?因为这两种方法效率比较低,故使用代码中的写法访问 Array 的内置函数。 \
IE 版本window.navigator.appVersion
上述代码返回一个字符串,表示所使用浏览器的版本号。它可能只包含一个数字,比如 5.0
,还可能包含一些其它的相关信息。