Home  >  Article  >  Web Front-end  >  js code to implement iframe dynamic adjustment of height_javascript skills

js code to implement iframe dynamic adjustment of height_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:06:57832browse
Copy code The code is as follows:

function SetWinHeight(obj)
{
var win= obj; >
win.height = win.contentDocument.body.offsetHeight;
else if(win.Document && win.Document.body.scrollHeight)
win.height = win.Document.body.scrollHeight;
}  
}  
}  


Finally, when adding iframe, you cannot lose the onload attribute. Of course, the id must also match win in the function
Program code



Copy code

The code is as follows:
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn