明辉手游网中心:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

检测客户端显示相应页面asp+js代码。

[摘要]<% bigurl = "bigscreen.htm" smallurl = "smallscreen.htm" A = LCase(Request.ServerVariables("HTTP_USER_AGENT&q...

<%
    bigurl = "bigscreen.htm"
    smallurl = "smallscreen.htm"
    A = LCase(Request.ServerVariables("HTTP_USER_AGENT"))
    if instr(A,"msie 5")>0 or instr(A,"msie 4")>0 then
%>

        <script language="JavaScript">
        var w = document.body.clientWidth;
        if (w>=650)
        {
            window.location.href="<%=bigurl%>";
        }
        else
        {
            window.location.href="<%=smallurl%>";
        }
        </script>

<%
    elseif instr(A,"msie 3")>0 then

        smallurl = "smallscreen.htm"
        bigurl = "bigscreen.htm"
        a = request("http_ua_pixels")
        url = smallurl
        if instr(a,"x")>0 then
            a = split(a,"x")
            if clng(a(0)) >= 650 then
                url = bigurl
            end if
        end if
        response.redirect(url)

    elseif instr(A,"zilla/4")>0 Then
%>

        <script language="JavaScript">
        var w = document.body.clientWidth;
        if (w>=650)
        {
            window.location.href="<%=bigurl%>";
        }
        else
        {
            window.location.href="<%=smallurl%>";
        }
        </script>

<%
    elseif instr(A,"zilla/3")>0 then
%>

        <script language="javascript">
        var Sizer=java.awt.Toolkit.getDefaultToolkit();
        var ScrSize=Sizer.getScreenSize();
        var ScrW=ScrSize.width;
        if (ScrW>=650)
        {
            window.location.href="<%=bigurl%>";
        }
        else
        {
            window.location.href="<%=smallurl%>";
        }
        </script>

<%
    else
        respose.redirect(smallurl)
    end if
%>