一个iframe高度自动变化的问题搞了我半天,网上找了下资料,不是很好,结合了一下jquery(版本1.3.2),4行代码即可,完美兼容IE、Firefox、Opera、Safari、Google Chrome,js如下:
-
- function heightSet(thisFrame){
- if($.browser.mozilla || $.browser.msie){
- bodyHeight =window.frames["thisFrameName"].document.body.scrollHeight;
- }else{
- bodyHeight =thisFrame.contentWindow.document.documentElement.
scrollHeight;
- }
- document.getElementById("thisFrameId").height=bodyHeight;
- }