找了好多书籍和资料但是终究没有一个源码的,没办法自得自己研究了!现在共享代码如下(换屏幕分辨率要刷新网页啊!)
客户端浏览器的分辨率: <SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "<br>网页可见区域宽:"+ document.body.clientWidth;
s += "<br>网页可见区域高:"+ document.body.clientHeight;
s += "<br>网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条的宽)";
s += "<br>网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
s += "<br>网页正文全文宽:"+ document.body.scrollWidth;
s += "<br>网页正文全文高:"+ document.body.scrollHeight;
s += "<br>网页被卷去的高:"+ document.body.scrollTop;
s += "<br>网页被卷去的左:"+ document.body.scrollLeft;
s += "<br>网页正文部分上:"+ window.screenTop;
s += "<br>网页正文部分左:"+ window.screenLeft;
s += "<br>屏幕分辨率的高:"+ window.screen.height;
s += "<br>屏幕分辨率的宽:"+ window.screen.width;
s += "<br>屏幕可用工作区高度:"+ window.screen.availHeight;
s += "<br>屏幕可用工作区宽度:"+ window.screen.availWidth;
s += "<br>你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
s += "<br>你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
document.write(s);
</SCRIPT> 动态控制iframe使用: <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<SCRIPT LANGUAGE="JavaScript">
function init_page()
{
document.getElementById('iframe_id').height=window.screen.availHeight-200;
}
</script>
</head>
<body class="bg" topmargin="0" style="overflow:hidden;" onLoad="init_page();">
<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td valign="top" bgcolor="#FFFFFF" >
<iframe id="iframe_id" name="taskiframe" width="840" src="webFrame.html" frameborder="0" hspace="0" vspace="0"></iframe>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" >
底部文件
</td>
</tr>
</table>
</body>
</html>
我最终解决的时候加了判断了的
function init_page()
{
if(eval("document.all.main")) //中间是某个ID号
{
document.getElementById('main').height=window.screen.availHeight-250;
}
}就是判断是否存在指定 的id
客户端浏览器的分辨率: <SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "<br>网页可见区域宽:"+ document.body.clientWidth;
s += "<br>网页可见区域高:"+ document.body.clientHeight;
s += "<br>网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条的宽)";
s += "<br>网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
s += "<br>网页正文全文宽:"+ document.body.scrollWidth;
s += "<br>网页正文全文高:"+ document.body.scrollHeight;
s += "<br>网页被卷去的高:"+ document.body.scrollTop;
s += "<br>网页被卷去的左:"+ document.body.scrollLeft;
s += "<br>网页正文部分上:"+ window.screenTop;
s += "<br>网页正文部分左:"+ window.screenLeft;
s += "<br>屏幕分辨率的高:"+ window.screen.height;
s += "<br>屏幕分辨率的宽:"+ window.screen.width;
s += "<br>屏幕可用工作区高度:"+ window.screen.availHeight;
s += "<br>屏幕可用工作区宽度:"+ window.screen.availWidth;
s += "<br>你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
s += "<br>你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
document.write(s);
</SCRIPT> 动态控制iframe使用: <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<SCRIPT LANGUAGE="JavaScript">
function init_page()
{
document.getElementById('iframe_id').height=window.screen.availHeight-200;
}
</script>
</head>
<body class="bg" topmargin="0" style="overflow:hidden;" onLoad="init_page();">
<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td valign="top" bgcolor="#FFFFFF" >
<iframe id="iframe_id" name="taskiframe" width="840" src="webFrame.html" frameborder="0" hspace="0" vspace="0"></iframe>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" >
底部文件
</td>
</tr>
</table>
</body>
</html>
我最终解决的时候加了判断了的
function init_page()
{
if(eval("document.all.main")) //中间是某个ID号
{
document.getElementById('main').height=window.screen.availHeight-250;
}
}就是判断是否存在指定 的id