欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS獲取scrollHeight問題想到的標(biāo)準(zhǔn)問題

 更新時(shí)間:2007年05月27日 00:00:00   作者:  
如果沒有文檔聲明可以用 document.body.scrollHeight,如果有文檔聲明必須用 document.documentElement.scrollHeight關(guān)于這方面的東西

我在作一個(gè)iframe自動(dòng)調(diào)整高度時(shí),被嵌入的頁面commit.asp的代碼如下:

復(fù)制代碼 代碼如下:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>的相關(guān)評(píng)論</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body bgColor="transparent" onload="zoomiframe();">
</body>
</html>
<script language=javascript>
<!--框架頁自動(dòng)調(diào)整尺寸-->
function zoomiframe()
{
parent.document.getElementById("comment_load").style.height=document.documentElement.scrollHeight;
}
</script>

然后在另外的頁面插入其它代碼,將這頁嵌入到其它頁面
<iframe src="comment.asp?classid=2&id=12" allowtransparency="true" name="comment_load" width="540" height="288" marginwidth="0" marginheight="0" align="middle" scrolling="no" frameborder="0"></iframe>

但是沒有效果,iframe不能按照內(nèi)容自動(dòng)調(diào)高度。
后來我在zoomiframe()加入了一句alert(document.body.scrollHeight);。彈出來的值為0,但如果直接運(yùn)行COMMIT。ASP彈出的高度卻與內(nèi)容相符。
實(shí)在搞不明白那里有沖途。我以前這樣作可以,不知道論壇上有沒有那個(gè)遇過這種問題。
謝謝!
復(fù)制代碼 代碼如下:

parent.document.all("comment_load").style.height=document.body.scrollHeight||document.documentElement.scrollHeight;

試了一下,應(yīng)該是沒什么問題的
<script type="text/javascript">
<!--
onload=function()
{
parent.document.getElementById('ac').style.height="200px";
}
//-->
</script>

<iframe src="comment.asp?classid=2&id=12" allowtransparency="true" name="comment_load" width="540" height="288" marginwidth="0" marginheight="0" align="middle" scrolling="no" frameborder="0"></iframe>

加一個(gè)ID屬性

PS:如果網(wǎng)頁中加入以下頭
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

必須用 document.documentElement.scrollHeight關(guān)于這方面的東西
如果沒有文檔聲明可以用
document.body.scrollHeight

相關(guān)文章

最新評(píng)論