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

80酷酷网    80kuku.com

  程序|分辨率|客户端|显示要求使用最新的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
"
   document.write "Your screen height is : " & screen.height & " pixels
"
   document.write "Your clientWidth is : " & document.body.clientWidth
   document.write " pixels
"
   document.write "Your clientHeight is : " & document.body.clientHeight
   document.write " pixels
"
   ' add the rest of the of the page's
   ' IE4 html code here...using document.write like :
   document.write "
<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 :


<A HREF="blank.htm">blank link</A>
</body>
</html>
<% end if %>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: