让网页具备浏览器识别功能
作者:杨孝忠 来源:- 添加时间:2006-5-21 9:21:45< script language="JavaScript"> fun-
ction testBrowser(){
ie=((navigator.appName=="Microsoft. Internet Explorer")&&&&
(parseInt(navigator.appVision) >=4)) ns=((navigator.appName=="Netscape")&&&&
(parseInt(navigator.appVision) >=4))
if(ie){self.location.href="index_ie.html";}
if(ns){self.location.href="index_ns.html";} }
< /script >
同时,还必须在该页面的<body>中加入对程序的调用:
< body onLoad="testBrowser()" >
</body>
这个调用在网页被加载时激活,如果浏览器是IE4.0或更高版本,浏览器就加载相应 index_ie.html;如果两种情况都不满足,浏览器就停留在现在的页面。
站内搜索