In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "how to set Iframe adaptive height in HTML", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to set Iframe adaptive height in HTML" article.
Mainly the following JS functions:
I. Program code
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
}
}
}
Finally, if you add iframe, you can't lose the onload attribute. Of course, id must also match the win in the function.
2. Program code:
Let's take a look at the iframe solution in another situation
Important note: the web address you must fill in in src= must be on the same site as this page, otherwise, you will make a mistake and say, "deny access!" (in fact, this is because access is denied because of Js's cross-domain problems.) now I'd like to share with you:
1. Create a bottom.js file, and then enter the following code
Parent.document.all ("frame ID name") .style.height=document.body.scrollHeight
Parent.document.all ("frame ID name") .style.width=document.body.scrollWidth
2. Add each of the included files in your website and pass the test under WINXP and IE6
Realize the adaptive height of iframe
To achieve the adaptive height of iframe, it can automatically adapt to the length of the page to avoid the phenomenon of scrollbars appearing on both the page and the iframe.
Program code
/ / * * iframe automatically adapts to the page * / /
/ / enter a list of the names of iframe whose height you want to automatically adjust according to the height of the page.
/ / separate the ID of each iframe with commas. For example: ["myframe1", "myframe2"], you can have only one form without a comma.
/ / define the ID of iframe
Var iframeids= ["test"]
/ / if the user's browser does not support iframe, whether to hide iframe means to hide yes, no means not to hide
Var iframehide= "yes"
Function dyniframesize ()
{
Var dyniframe=new Array ()
For (iTuno; I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.