针对 iframe 的自适应高度我写了一个函数, 你自己再发挥一下吧(此代码放在iframe里):function parentIframeHeight()
{
if(top!=self && self.name!="")
{
var e;
/*@cc_on @*/ /*@if (@_jscript_version>=3) e = window.parent.document.all(self.name); @else @*/
if(window.navigator.appName=="Netscape" && parseInt(window.navigator.appVersion)>5)
e = window.parent.document.getElementById(self.name);
else e = eval("window.parent."+ self.name);
/*@end @*/
e.height = parseInt(document.body.scrollHeight, 10);
}
}
{
if(top!=self && self.name!="")
{
var e;
/*@cc_on @*/ /*@if (@_jscript_version>=3) e = window.parent.document.all(self.name); @else @*/
if(window.navigator.appName=="Netscape" && parseInt(window.navigator.appVersion)>5)
e = window.parent.document.getElementById(self.name);
else e = eval("window.parent."+ self.name);
/*@end @*/
e.height = parseInt(document.body.scrollHeight, 10);
}
}
解决方案 »
- jquery 的each 函数中参数i自动增加时,初始值是0还是1
- 求救 函数A中的变量,传给函数B的变量
- 在线等 做了一个图片拖动,为什么onmousemove 写个没有实现的方法可以,这个方法怎么实现
- [图]404错误 请CSDN的工程师们进来解释一下这个原因.
- 关于Alexa的问题
- 用javascript 如何传递和接收参数?
- 请问有什么方法可以在网页中获得自己页面的全部源代码?
- 请教:在document.write语句里如何换行?
- [求助]JS乘法计算,看起来很简单
- 如何能得到window.open()的对象?
- 如何在javascript中判断浏览器的版本或其他信息
- 在线等:请问这样的引号怎么转换。
<iframe id="iframeID" height='100' src="1.htm"></iframe>
1.htm <body onload="parent.window.document.all.iframeID.height=document.all.bd.clientHeight + 40">
<table id=bd>
<tr>
<td>
<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net
<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net</td>
</tr>
</table>
请问meizz:
这段代码放在iframe嵌的那张页面里吗?
NAME='PICC_CoverInfo'
ID='PICC_CoverInfo'
FRAMEBORDER=0
marginWidth="0"
marginHeight="0"
scrolling=no
width="100%"
onload='var f=document.all["PICC_CoverInfo"]; var b=f.Document.body; f.height=b.scrollHeight'>
</iframe>