Implementation of an adaptive height of IFRAME can automatically adapt to the length of the page to avoid the pages of the scroll bar at the same time.
The source code is as follows
// ** iframe automatic adaptation page **//
// Enter the list of the names of the IFRAME to be automatically adjusted according to the page height
// Separate each iframe ID with a comma. For example: ["MyFrame1", "MyFrame2"], can have only one form, no comma.
/ / Define IFRAME ID
Var iframeids = ["Test"]
// If you have no у у с с mystery FRAME indicates iframe hidden YES hides, NO means not hidden
Var iframehide = "yes"
Function Dyniframesize ()
{
Var Dyniframe = new arrival ()
For (i = 0; i { IF (Document.GtelementByid) { // Automatically adjust the IFRAME height Dyniframe [DYNIFRAME.LENGTH] = Document.GetElementByid (iframeids); IF (Dyniframe &&! WINDOW.Opera) { Dyniframe.Style.display = "block" IF (Dyniframe.ContentDocument && Dyniframe.ContentDocument.body.offsetHeight) // If the user's browser is Netscape Dyniframe.height = DYNIFRAME.CONTENTDocument.body.offsetHeight; Else IF (Dyniframe.Document && Dyniframe.Document.body.scrollHeight) // If the user's browser is IE Dyniframe.height = DYNIFRAME.Document.body.scrollHeight; } } / / Depending on the set parameters, the display problem of the browser that does not support IFRAME is not supported. IF ((Document.All || Document.getElementByid) && iframehide == "no") { Var Tempobj = Document.all? Document.All [iframeids]: Document.GetElementByid (iframeids) Tempobj.Style.Display = "block" } } } WINDOW.ADDEVENTLISTENER) Window.addeventListener ("LOAD", Dyniframesize, False) Else if (window.attachevent) Window.attachevent ("OnLoad", Dyniframesize) Else Window.οnlοad = DYNIFRAMESIZE script>