今天是:

注册会员|会员登陆|设为首页|加入收藏|广告服务|韩文翻译|RSS阅读|繁體中文

您现在的位置: 韩国设计资源网 >> 设计师学院 >> 网站运营 >> 网站优化 >> 教程正文

让我们设计的网页自适应客户端分辨率

  • 作者:未知 文章来源:未知 点击数: 更新时间:2006-7-2 21:53:47 用户收藏
 function redirectPage(){ 
 var url800x600=〃index-ie.html〃; //定义两个页面,此处假设index-ex.html和1024-ie.html同change-ie.html在同一个目录下 
 var url1024x768=〃1024-ie.html〃; 
 if ((screen.width==800) && (screen.height==600)) //在此处添加screen.width、screen.height的值可以检测更多的分辨率 
 window.location.href= url800x600; 
 else if ((screen.width==1024) && (screen.height==768)) 
 window.location.href=url1024x768; 
 else window.location.href=url800x600; 
 } 
 // --> 
 < /script> 

 然后再在< body…>内加入onLoad=〃redirectPage()〃
 最后,同样地,在< body>和< /body>之间加入以下代码来显示网页的工作信息:

 < script language=JavaScript> 
 < !-- 
 var w=screen.width 
 var h=screen.height 
 document.write(〃系统已检测到您的分辨率为:〃); 
 document.write(〃< font size=3 color=red>〃); 
 document.write(w+〃×〃+h); 
 document.write(〃< /font>〃); 
 document.write(〃正在进入页面转换,请稍候…〃); 
 // --> 
 < /script>

上一页  [1] [2] [3]