当链接更改页面时,是否可以刷新iframe中的onload函数/使其调整为内容大小

当链接更改页面时,是否可以刷新iframe中的onload函数/使其调整为内容大小,iframe,refresh,onload,Iframe,Refresh,Onload,我正在尝试将页面大小调整为iframe中加载内容的大小 访问时加载的第一个页面列表中有很多视频,这使得页面相当长。但是,当我将另一个较小的页面加载到其中时,它将保持与先前加载的页面相同的较大大小,以下是我的工作代码: <div class="videoplayer"> <iframe src="video/index.html" frameborder="0" scrolling="no" width="668" name="videoplayer" onload="t

我正在尝试将页面大小调整为iframe中加载内容的大小

访问时加载的第一个页面列表中有很多视频,这使得页面相当长。但是,当我将另一个较小的页面加载到其中时,它将保持与先前加载的页面相同的较大大小,以下是我的工作代码:

<div class="videoplayer">
    <iframe src="video/index.html" frameborder="0" scrolling="no" width="668" name="videoplayer" onload="this.style.height=this.contentDocument.body.scrollHeight +'px';"></iframe>
</div>

以下是菜单中的链接:

<p>
    <a href="video/index.html" target="videoplayer">Featured Video's</a> | 
    <a href="video/Anub1s.html" target="videoplayer">Anub1s</a> | 
    <a href="video/Bl4ze.html" target="videoplayer">Bl4ze</a> | 
    <a href="video/DrJ4y.html" target="videoplayer">DrJ4y</a> | 
    <a href="video/Budboy.html" target="videoplayer">Budboy</a> | 
    <a href="video/KillerClay.html" target="videoplayer">Killer Clay</a> | 
    <a href="video/Pewpew.html" target="videoplayer">PewPew</a>
</p>

| 
| 
| 
| 
| 
| 

有没有办法刷新onload函数,让它知道它已被更新

所以我一直在尝试这样做:

上面的页面有此代码^^

<script>
window.onload = function() {
    parent.iframeLoaded();
}
</script>

window.onload=函数(){
parent.iframeload();
}
这是主页上的内容:

<script>
function iframeLoaded() {
    this.style.height=this.contentDocument.body.scrollHeight +'px';
}
</script>

函数iframeload(){
this.style.height=this.contentDocument.body.scrollHeight+'px';
}

在iframe中使用
onload=“iframeload();”
。。但它不起作用

我读过相关文章,不知道如何发送链接,然后调整大小,如果有人能帮忙,请评论我;我尝试过各种javascript方法,但都不起作用