有时候网页在不同的分辨率下视觉效果不一样,为了达到最佳的视觉效果,最好的方法是做几版网页,让他们各自适应常用的几种分辨率,最后使用下面介绍的代码,来判断浏览者的分辨率,给予最佳的视觉效果。
这种方法比较简单地,呵呵。大家可以根据自己地要求改。
做3个页面,分别命名为“640480.htm”“800600.htm“1024768.htm”,3个页面分别为三种分辨率下浏览的页,然后index.htm的原代码如下:
<html>
<head>
<script LANGUAGE="JavaScript">
<!--Begin
function redirectPage(){
var url640x480="640480.htm";
var url800x600="800600.htm";
var url1024x768="1024768.htm";
if((screen.width==640)&&(screen.height==480))
window.lacation.href=url640x480;
else if((screen.width==800)&&(screen.height==600))
window.lacation.href=url800x600;
else if((screen.width==1024)&&(screen.height==768))
window.lacation.href=url1024x768;
else window.lacation.href=url800x600;
}
//End--!>
</script>
</head>
<body OnLoad="redirectPage();">
</body>
</html>
2022-08-18
2022-08-18
2022-08-18
2022-07-04
2022-07-04
2022-06-27
2022-06-27
2022-06-21
2022-06-21
2022-06-20
2022-06-20
2022-06-16