根据客户端的分辨率不同而重定向到不同网页的脚本

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 lfly001 的 blog

我们知道,对于客户端分辨率的问题可以通过asp在服务器端进行判断,我用javascript脚本也可以完成这个功能。下面是源程序:

<script language="javascript">
if (window.screen){
  var widths = screen.width;
  url_640 = "default800.htm";
  url_800 = "default800.htm";
  url_1024 = "default1024.htm";
  if(widths<740){
    self.location.replace(url_640);
  }
  if(widths>=740 & w<835){
    self.location.replace(url_800);
  }
  if(widths>=835){
    self.location.replace(url_1024);
  }
}
</script>

如果大家还有好的方法,请告诉我。

本文关键:分辨率
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top