asp擷取螢幕解析度

來源:互聯網
上載者:User

<%
'若已經自動轉向執行此條件陳述式
if Bint(trim(request("sw"))) > 0 then
   session("MyScreenWidth")=Bint(trim(request("sw")))
   session("MyScreenHeight") = Bint(trim(request("sh")))
   response.Redirect(session("FrontUrl"))
end if
if Bint(session("MyScreenWidth"))=0 then
if Bint(trim(request("sw"))) = 0 then
   session("FrontUrl") = GetUrl()
end if
response.Write("<scr"&"ipt>")
if Instr(GetUrl(),"?") > 0 then
   response.Write("window.location='"&GetUrl()&"&sw='+screen.width+'&sh='+screen.height;")
else
   response.Write("window.location='"&GetUrl()&"?sw='+screen.width+'&sh='+screen.height;")
end if
response.Write("</scr"&"ipt>")
end if
%>

<%="你的解析度是:"&session("MyScreenWidth")&"*"&session("MyScreenHeight")%>

<%
'下面是幾個函數
Function Bint(str)
If IsNumeric(str) then
   Bint = Clng(str)
Elseif IsEmpty(str) then
   Bint = 0
Elseif IsNull(str) then
   Bint = 0
Else
   Bint = 0
End if
End function
Function GetUrl()
sUrl = Request.ServerVariables("URL")
sQueryString = ""
For Each x In Request.QueryString
sQueryString = sQueryString & "&" & x & "=" & Server.URLEncode(Request(x))
Next
if len(sQueryString)>0 then
sQueryString = right(sQueryString,len(sQueryString)-1)
else
sQueryString = ""
end if
if len(sQueryString)>0 then
GetUrl = sUrl & "?" & sQueryString
else
GetUrl = sUrl
end if
End function
%>

 

 

顯示你瀏覽器的相關資訊:
<%= reguest.servervariables("http_user_agent")%>
顯示瀏覽器的版本:
<% set bc=server.createobject("mswc.browsertype")
  response.write bc.browser
  response.write bc.version
%><%
Function Browser(Info)
Info=Request.ServerVariables("Http_User_Agent") '在這裡初始化了Info,在實際應用中可以作為其他變數賦值
If InStr(Info,"MSIE 7")>0 Then
Browser="Internet Explorer 7.0"
ElseIf InStr(Info,"MSIE 6")>0 Then
Browser="Internet Explorer 6.0"
ElseIf InStr(Info,"MSIE 5.5")>0 Then
Browser="Internet Explorer 5.5"
ElseIf InStr(Info,"MSIE 5.0")>0 Then
Browser="Internet Explorer 5.0"
ElseIf InStr(Info,"MSIE 4")>0 Then
Browser="Internet Explorer 4.0"
Else
Browser="未知的瀏覽器!"
End if
Response.Write "您的瀏覽器是:"&Browser&"<p>"
End Function Function System(Info)
Info=Request.ServerVariables("Http_User_Agent")
If InStr(Info,"NT 5.1")>0 Then
System="Windows XP"
ElseIf InStr(Info,"NT 5.0")>0 Then
System="Windows 2000"
ElseIf InStr(Info,"NT 4")>0 Then
System="Windows NT"
ElseIf InStr(Info,"98")>0 Then
System="Windows 98"
ElseIf InStr(Info,"Me")>0 Then
System="Windows Me"
ElseIf InStr(Info,"95")>0 Then
System="Windows 95"
Else
System="未知的作業系統!"
End if
Response.Write "您的作業系統是:"&System&"<p>"
End Function Call Browser(Info)
Call System(Info) %>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.