怎样用程序检测网页的显示分辨率

来源:百度知道 编辑:UC知道 时间:2024/06/13 23:05:40
怎样用程度检测网页的显示分辨率
我做了一个网页 想让它能适应不同的显示分辨率
是1024*768 还是800*600
这段程序怎么写

<script language="JavaScript1.2">
<!--
var correctwidth=1024
var correctheight=768
if (screen.width!=correctwidth||screen.height!=correctheight)
document.write("本站最佳分辨率: "+correctwidth+"*"+correctheight+". 你当前的分辨率是:"+screen.width+"*"+screen.height+"。设置合适的分辨率才能取得最佳的显示效果!")
//-->
</script>

可以根据以上程序扩展了~~