www.BCZJ.com【编程之家】 >> ASP基础 >> 表格自适应页面高度

表格自适应页面高度

www.BCZJ.com【编程之家】 www.bczj.com admin 2007-2-22 0:38:59

<html>

<head>

<title>...</title>

<script language="JavaScript" type="text/javascript">

function x(){

var y=""

y+='scrollHeight:'+document.body.scrollHeight;

y+=' offsetHeight:'+document.body.offsetHeight;

y+=' clientHeight:'+document.body.clientHeight;

//document.body.appendChild(document.createTextNode(y))

window.alert(y);

if(document.body.scrollHeight<document.body.offsetHeight)

{

mytab.height+=(document.body.offsetHeight-document.body.scrollHeight)

}

}

</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">

<!--

body {

margin-top: 0px;

margin-bottom: 0px;

}

-->

</style></head>

<body onload="x();">

<table width="514" height="300" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666" id="mytab">

<tr>

<td> </td>

</tr>

</table>

</body>

</html>

责任编辑: 参与评论
【编程之家】版权所有 www.bczj.com 沪ICP备06025676号 QQ:382611662
Powered By: 上海驰志网络 3.0 Beta