判断浏览者分辨率的同时进入相应页面的脚本,示例中800×600进入网易,640×480进入搜狐,1024×768进入新浪。这样就可以做适应多种分辨率的页面了,其中页面链接可以设定。
制作方法:
在<head>标签下,粘贴代码,修改链接即可:
<script language="JavaScript1.2">
<!--
if (screen.width==800||screen.height==600) //if 800x600
window.location.replace("http://www.163.com")
else if (screen.width==640||screen.height==480) //if 640x480
window.location.replace("http://www.sohu.com")
else if (screen.width==1024||screen.height==768) //if 1024x768
window.location.replace("http://www.sina.com.cn")
else //if all else
window.location.replace("http://www.hot4.org/java")
//-->
</script>
至此,我们的效果便制作好了,你不仿试试!
本文作者: