设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

这个asp程序可显示IE.NC客户端的屏幕分辨率

作者:佚名 出处:网络转载 时间:11-19 点击:

内容载入中...
要求使用最新的browscap.ini,不然造成IE5,NC46等新的浏览器无法正确运行.

<HTML>
<head>
<TITLE>detectres.ASP</TITLE>
</head>

<%
  Set bc = Server.CreateObject("MSWC.BrowserType")
  brname=bc.browser
  brver=bc.version
%>
<% if brname="IE" and cint(brver)>=4 then %>
<body bgcolor=white onload="doit()">
<script language=vbscript>
<!--
sub doit()
   document.write "Your screen width is : " & screen.width & " pixels<br>"
   document.write "Your screen height is : " & screen.height & " pixels<br>"
   document.write "Your clientWidth is : " & document.body.clientWidth
   document.write " pixels<br>"
   document.write "Your clientHeight is : " & document.body.clientHeight
   document.write " pixels<br>"
   ' add the rest of the of the page's
   ' IE4 HTML code here...using document.write like :
   document.write "<br><A HREF='blank.htm'>blank link</A>"
end sub
-->
</script>
'any regular HTML code you put here
'will disappear after the document.writes
</body>
</HTML>
<% else %>

<body bgcolor=white>
<% response.write "You're using " & brname & ", version # " & cint(brver) & " with " %>

<% if brname="IE" and cint(brver)=3 then
   pixels=Request.ServerVariables("HTTP_UA_PIXELS")
   color=Request.ServerVariables("HTTP_UA_COLOR")
   response.write "Pixels=" & pixels & ", colors=" & colors
%>
<p>

' add the rest of the page's IE3 HTML code here...

</body>
</HTML>
<% end if %>

<% if brname="Netscape" and (cint(brver) > 1) then %>
<body bgcolor=white>
<Script Language="JavaScript">
<!--
if(navigator.javaEnabled())
   {
   var tools=java.awt.Toolkit.getDefaultToolkit();
   var size=tools.getScreenSize();
   w=size.width;
   h=size.height;
   }
document.write("Screen size : " + w + " x " + h + " pixels.");
//-->
</script>
<% end if %>
<p>
' add other Netscape HTML code here...like :
<br>
<A HREF=../../"blank.htm">blank link</A>
</body>
</HTML>
<% end if %>
收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息