检测浏览器是否为IE的最简单的方法
!-[1,]
以下是测试代码:
<html>
<head>
<script>
var isIE = !-[1,];
alert("isIE:"+isIE);
</script>
</head>
<body>
</body>
</html>太强了!
<html>
<head>
<script>
var isIE = !-[1,];
alert("isIE:"+isIE);
</script>
</head>
<body>
</body>
</html>// 人的基類var Person=new ( function(){ var sex; var name; this.getSex=function() &nbs…
1>获取控件用document.getElementById,不用document.all(FF等浏览器不支持)2><button> 会被firefox解释为提交form或者刷新页面,需要写标准<button type="button">3>使用childN…
1>window.prompt(text, value) 簡單的基與模態窗體的對話框,(返回你輸入) var v=window.prompt("提示","請輸入你的名字")2>window.confirm(text,mess) 模態確認框(返回"是/否…
基本方法:attachEvent(IE)/detachEvent;addEventListener( Mozilla, Netscape, Firefox)/removeEventListener在之前的邏輯判斷式的基礎上,在設計javascript的時候,可以針對瀏覽器的不同,寫出適合不同種類瀏覽…
1.document.formName.item("itemName") 问题说明:IE下,可以使用document.formName.item("itemName")或document.formName.elements["elementName"];Firefox下,只能使用docum…
本来一个写好了的脚本在IE下正常,可是在mozilla firefox中我们发现程序报类似如下的错误: event is not defined obj has no properties 原因是Firefox中使用了不同的事件对象模型,不同于IE Dom,用的是W3C Dom. 下是我在网上找到的…