<1> This is my first experience, and I did not study it:Code-->
1 < IFRAME Name = "Ifrname" SRC = "Targetname.htm" Frameborder = False Scrolling = "Auto" Width = "100%" Height = "100%" Frameborder = No Onload = "Document.allpolic'ifrname').style.height?ifrname.doc ument. Body. scrollheight" > </ IFRAME >
<2> This is currently in use. It feels very useful, perfect! : Code --> < IFRAME Name = "Main" SRC = "Welcome. aspx" Frameborder = "0" Width = "100%" Onload = "This.height?this.content=doc ument. Body. scrollheight"
Allowtransparency = "True" Scrolling = "No" > </ IFRAME >
<3> I heard that FF also works. I don't think that only code is posted. -->
Step 1 JS
Function getsize (){
VaR xscroll, yscroll;
If (window. innerheight & window. scrollmaxy ){
Xscroll = Document. Body. scrollwidth;
Yscroll = Window. innerheight + window. scrollmaxy;
} Else if (document. Body. scrollheight> document. Body. offsetheight) {// all but explorer Mac
Xscroll = Document. Body. scrollwidth;
Yscroll = Document. Body. scrollheight;
} Else {// explorer Mac... wocould also work in Explorer 6 strict, Mozilla and Safari
Xscroll = Document. Body. offsetwidth;
Yscroll = Document. Body. offsetheight;
}
VaR implements wwidth, implements wheight;
If (self. innerheight) {// All privileges t Explorer
Required wwidth = self. innerwidth;
Optional wheight = self. innerheight;
} Else if (document.doc umentelement & document.doc umentelement. clientheight) {// Explorer 6 strict Mode
Required wwidth = document.doc umentelement. clientwidth;
Required wheight = document.doc umentelement. clientheight;
} Else if (document. Body) {// other explorers
Required wwidth = Document. Body. clientwidth;
Optional wheight = Document. Body. clientheight;
}
// For small pages with total height less then height of the viewport
If (yscroll <windowheight ){
Pageheight = running wheight;
Y = pageheight;
} Else {
Pageheight = yscroll;
Y = pageheight;
}
If (xscroll <1_wwidth ){
Pagewidth = required wwidth;
} Else {
Pagewidth = xscroll;
}
Arraypagesize = new array (pagewidth, pageheight, expires wwidth, expires wheight)
Return arraypagesize;
}
This code is used to obtain the parameters of the target page, including the page height, width, screen height, and width.
Function autoheight (PID ){
VaR x = new getsize ();
Parent.doc ument. getelementbyid (PID). Height = x [1];
}
This code is used to implement highly adaptive IFRAME in the parent page.
\\\\\\\\\\
Step 2 page
<Div class = "onright" style = "width: 480px; "> <IFRAME id =" infrm "name =" infrm "marginwidth =" 0 "marginheight =" 0 "width =" 100% "src =" park.htm "frameborder =" 0 "scrolling = "Auto"> </iframe>
This is the IFRAME of the parent page, which is nothing special. It is the same as the ordinary IFRAME, but you must set the id value so that the parameters of the Child page can be called.
<Body onload = "autoheight ('irm')"> </body>
Use the onload event in the body to send its height to the IFRAME of the parent page.
This article from: the foot home (www.jb51.net) detailed source reference: http://www.jb51.net/article/10616.htm
<4> This is a poor item, which is used under the root directory. Hey, this is code:
< Script Type = " Text/JavaScript " >
Function Setwinheight (OBJ)
{
VaR Win = OBJ;
If (Document. getelementbyid)
{
If (Win && ! Window. Opera)
{
If (Win. contentdocument && Win. contentdocument. Body. offsetheight) win. Height = Win. contentdocument. Body. offsetheight;
Else If (Win. Document && Win. Document. Body. scrollheight)
Win. Height = Win. Document. Body. scrollheight;
}
}
}
< / SCRIPT>
< IFRAME Frameborder = "0" Name = "Win" ID = "Win" SRC = "Index.html" Onload = "Javascript: setwinheight (this )" Align = "TOP" Width = "100%" Scrolling = "No" > </ IFRAME >