JavaScript检测分辨率

JavaScript--检测分辨率

以下代码加入<HEAD>区:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url640x480 = "http://www.17357.net/640x480";**记得改相应的页面
var url800x600 = "http://www.17357.net/800x600";
var url1024x768 = "http://www.17357.net/1024x768";
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>

以下代码加入<BODY>区:
<center>
<form>
<input type=button value="进入符合分辨率的页面" onClick="redirectPage()">
</form>
</center>

原文地址:https://www.cnblogs.com/xiaodi/p/126815.html