上一篇:JS 小游戏 >>
检测屏幕的分辨率
这个小程序在用户进入页面的时候会检测它们的分辨率,然后根据分辨率的不同,指向相应的页面。当然,讲究的你应当事先分别做好800×600和640×480的页面。try it,really good!
注意:本例没有为不同的分辨率作相应的页面,你可以按下面的按钮看看出现的提示,你只要明白意思就可以了。
| 以下代码加入<head>区: <script language="javascript"> <!-- begin function redirectpage() { var url640x480 = "http://www.yoursite.com/640x480.html";**记得改相应的页面 var url800x600 = "http://www.yoursite.com/800x600.html"; var url1024x768 = "http://www.yoursite.com/1024x768.html"; if ((screen.width == 640) && (screen.height == 480)) window.location.href= url640x480; else if ((screen.width == 800) && (screen.height == 600)) window.location.href= url800x600; else if ((screen.width == 1024) && (screen.height == 768)) window.location.href= url1024x768; else window.location.href= url640x480; } // end --> </script> 下一篇:使用 ASP.NET 加密口令 >> 相关文章:
© 2006 www.java-asp.net
|
