- function iframeAutoHeight (iframeId) {
- ug_frame = document.getElementById(iframeId)
- if (ug_frame == null) return
- window.setInterval(function() {
- try {
- var bHeight = ug_frame.contentWindow.document.body.scrollHeight
- var dHeight = ug_frame.contentWindow.document.documentElement.scrollHeight
- var height = Math.min(bHeight, dHeight)
- ug_frame.height = height
- } catch (e) {}
- }, 200)
- }
- //该片段来自于http://www.codesnippet.cn/detail/2910201410815.html
来源: http://www.codesnippet.cn/detail/2910201410815.html