运行代码 缩小
汉王
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
<title>分辨率导航页面</title>
6
<body>
7
<script LANGUAGE="JavaScript">
8
<!-- Begin
9
function redirectPage() {
10
var url640x480 = "http://www.163.com/";
11
var url800x600 = "http://www.qiyi.com/";
12
var url1024x768 = "http://www.baidu.com/";
13
if ((screen.width == 640) && (screen.height == 480)) 
14
window.location.href= url640x480;
15
else if ((screen.width == 800) && (screen.height == 600))
16
window.location.href= url800x600;
17
else if ((screen.width == 1024) && (screen.height == 768))
18
window.location.href= url1024x768;
19
else window.location.href= url640x480;
20
}
21
// End -->
22
</script>
23
<form>
24
<input type=button value="进入符合分辨率的页面" onClick="redirectPage()">
25
</form>
26
</body>
27
</html>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
CSS代码...
x
 
1
JS代码
复制 格式化 注释 注释 清空
放大
JS代码...
xxxxxxxxxx
1
 
1
名称
按分辨率导航相应页面
分类
网站常用
描述
这是一个比较实用的JS小特效,按分辨率导航相应页面,当用户访问时,判断用户电脑的分辨率,并导航至对应的分辨率页面上,以获得较高的用户体验。
收藏