You can use this javascript function to resize the height of your iframe depending on the size of your parent page.
JAVASCRIPT:
-
<script language="JavaScript">
-
function iFrameHeight() {
-
if(document.getElementById && !(document.all)) {
-
h = document.getElementById('main').contentDocument.body.scrollHeight;
-
document.getElementById('main').style.height = h + 100;
-
}
-
else if(document.all) {
-
h = document.frames('main').document.body.scrollHeight;
-
document.all.main.style.height = h + 100;
-
}
-
}
4 Responses
hadi
February 16th, 2008 at 2:53 pm
1please explain it, where should i put it? in mail page or in frame content page?
aRo`
February 17th, 2008 at 2:35 pm
2You should put this code in the main page.
If you need some help, just let me know!
Mattias Jacobsson
June 9th, 2008 at 10:58 am
3How do I set the height and widt? My code:
function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById(’main’).contentDocument.body.scrollHeight;
document.getElementById(’main’).style.height = h + 100;
}
else if(document.all) {
h = document.frames(’main’).document.body.scrollHeight;
document.all.main.style.height = h + 100;
}
}
Corey
October 4th, 2008 at 11:19 pm
4i was wondering if you could assist me in making this work for me…i am using dolphin 6.1.4 and have phpbb3 forums….and i have managed to get them to appear inside the site using iframe but i cant seem to get it to auto height….here is my site if u need to look at it….
http://truegamerspace.com
RSS feed for comments on this post · TrackBack URI
Leave a reply
Who is aRo` ?
I'm an e-commerce consultant trapped in a developpers mindset.I work with:
Popular posts
Recent posts
Categories
Links
Software
Calendar
Archives
Mybloglog
Add me to skype