开发者

Style and Javascript Not Working

I have the following seems to work in Internet Explorer but not Chrome. Can anyone please explain why, and what I should do to correct it.

<iframe id="confirmed_list" src="./meets/confirmed.php?meet_id=$1" scrolling="no" width="80%" onload="document.getElementById('confirmed_list').height = confirmed_list.document.body.scrollHeight">
</iframe>

The script should automa开发者_运维技巧tically extend the height of the iframe to fit the contents. Internet Explorer gets the value right, however Chrome seems to calculate the value massively incorrectly.

Any ideas?


Take another good look what's happening here:

document.getElementById('confirmed_list').height = confirmed_list.document.body.scrollHeight

In this event handler, confirmed_list was never defined. I'm sure you mean document.getElementById( 'confirmed_list' ) here.

Anyway, a better solution is to use this, as it refers to the iframe:

this.height = this.document.body.scrollHeight
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜