2010年12月11日星期六

Javascript/JS获取屏幕分辨率及工作区高度和宽度的方法

下面是一段测试的代码,实际的执行结果,请自行测试吧

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JSSize</title>
</head>
<body>
<script type="text/javascript">
document.write("document.documentElement.clientHeight:" + document.documentElement.clientHeight + "<br/>");
document.write("document.documentElement.clientWidth:" + document.documentElement.clientWidth + "<br/>");

document.write("window.screen.height:" + window.screen.height + "<br/>");
document.write("window.screen.width:" + window.screen.width + "<br/>");

document.write("window.screen.availHeight:" + window.screen.availHeight + "<br/>");
document.write("window.screen.availWidth:" + window.screen.availWidth + "<br/>");
</script>
</body>
</html>

没有评论:

发表评论