当前位置:编程学习 > JAVA >>

Html中利用JavaScript根据屏幕分辨率打开相应的页面!(示例)

由于设计的页面需要对1280*760和1440*900都有较好的兼容性,因此,做了两个页,经过一番摸索,终于解决了,小儿科的技巧,高手勿看!

 

 

[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head> 
    <title>Untitled Page</title> 
 
    <script language="javascript"> 
            if (window.screen) 
            { 
                var m_height=screen.height; 
                m_768="login_768.html"; 
                m_900="login_900.html"; 
                if (m_height<900) { 
                    self.location.replace(m_768); 
                } 
                if (m_height >= 900) 
                { 
                    self.location.replace(m_900); 
                } 
            } 
    </script> 
 
 
 
</head> 
<body> 
 
</body> 
</html> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>

    <script language="javascript">
            if (window.screen)
            {
                var m_height=screen.height;
                m_768="login_768.html";
                m_900="login_900.html";
                if (m_height<900) {
                    self.location.replace(m_768);
                }
                if (m_height >= 900)
                {
                    self.location.replace(m_900);
                }
            }
    </script>

 

</head>
<body>

</body>
</html>

 

补充:web前端 , HTML/CSS  ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,