Compatible with the mainstream browser's Iframe adaptive height, the JS script is as follows:
Copy Code code as follows:
IFRAME highly adaptive
function Iframeautofit (iframeobj) {
settimeout (function () {
if (!iframeobj) return;
Iframeobj.height = (iframeobj.document iframeObj.Document.body.scrollHeight: IframeObj.contentDocument.body.offsetHeight);
}, 200);
}<span style= "font-family:arial, Helvetica, Sans-serif;" > </span>
Call Method:
Copy Code code as follows:
<iframe id= "Hqright" name= "Hqright" onload= "Javascript:iframeautofit" (this); "
Height= "235px;" width= "770px" frameborder= "0" scrolling= "no"
Src= "Market/hqdata_page.aspx?t=tjs" ></iframe>
Extended:
Copy Code code as follows:
Add styles Dynamically
function addsheetfile (obj, path) {
if (obj = = Undefined | | obj = NULL)
obj = document;
var fileref = obj.createelement ("link")
Fileref.rel = "stylesheet";
Fileref.type = "Text/css";
Fileref.href = path;
Fileref.media = "screen";
var headobj = obj.getelementsbytagname (' head ') [0];
Headobj.appendchild (FILEREF);
}