这个asp程序可显示IE.NC客户端的屏幕分辨率
发表于:2007-06-30来源:作者:点击数:
标签:
要求使用最新的browscap.ini,不然造成IE5,NC46等新的浏览器无法正确运行. HTML head TITLEdetectres.asp/TITLE /head % Set bc = Server.CreateObject(MSWC.BrowserType) brname=bc.browser brver=bc.version % % if brname=IE and cint(brver)=4 then % body
要求使用最新的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 %>
原文转自:http://www.ltesting.net