home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

resizing problem with iframe and td tag

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1962
Discussions: 204,347, Posts: 2,417,510, Members: 249,759
Old November 30th, 2004, 10:29 PM   Digg it!   #1 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,445
Send a message via AIM to cracked
resizing problem with iframe and td tag

hi. i am trying to put forums on my website. i have them in an iframe which is inside of a td tag for a table. the problem i am having is that i cant seem to get the td or the iframe to dynamically resize their height if the height of the forum page changes. all i can seem to do it set it at a particular height. ive tried using height="100%" on both the td and the iframe but that doesnt help. what can i do to make them be the right size?
__________________
Visit http://duroo.org
cracked is offline   Reply With Quote
Old November 30th, 2004, 10:54 PM     #2 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,334
add the code so your body tag on the forum page (the page inside the iframe) so it looks like this:
Code:
<body onload="if(parent.IFRAME_size_to_content)parent.IFRAME_size_to_content('content')">
Now, on the page where the actual iframe tages are:

Put this in the header section of your page (between the <head> and </head> tags)

Code:
<script type="text/javascript" language="javascript">

function getIFRAME_doc_height(IFrameDoc) {
return (typeof IFrameDoc.height != 'undefined') ?
IFrameDoc.height + 16 :
(IFrameDoc.body && typeof IFrameDoc.body.scrollHeight != 'undefined') ?
IFrameDoc.body.scrollHeight + 30 :
null;
}

function IFRAME_size_to_content(iframe_ref) {
var IFrameDoc, oIframe = document.getElementById(iframe_ref);
if (typeof oIframe != null) {
if (oIframe.contentDocument) IFrameDoc = oIframe.contentDocument;
else if (oIframe.contentWindow) IFrameDoc = oIframe.contentWindow.document;
else if (oIframe.document) IFrameDoc = oIframe.document;

var hgt = getIFRAME_doc_height(IFrameDoc);
if (hgt) oIframe.style.height = String(hgt + 'px');
}
}

</script>
And your iframe tag....
Code:
<iframe src="forumpage.php" width="600" hieght="600" name="content" id="content" scrolling="no"></iframe>
Changing the source and width to whatever you'd like
The height doesnt really matter, it should automatically adjust when the page loads due to the script.

Realistically though, an iframe is kind a silly way to do it
You'd be better off just doing a php include. Just place the php code block whereever you want the content to be loaded into on the page (in this case, in the TD).

Code:
<?php include("forumpage.php"); ?>
Assuming your server supports php and then save your page that loads the forum as .php
VHockey86 is offline   Reply With Quote
Old November 30th, 2004, 10:58 PM     #3 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,445
Send a message via AIM to cracked
nevermind, got it

http://www.geeklog.net/article.php/20030213110315177

those guys are awesome

thanks anyway

EDIT: thanks VHockey, but i already got it. i had tried using an include but phpbb2 is funny and everything looked messed up when i tried it and the links didnt work well. but thanks again!!

Last edited by cracked : November 30th, 2004 at 11:00 PM.
cracked is offline   Reply With Quote
Old December 1st, 2004, 09:53 PM     #4 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,445
Send a message via AIM to cracked
i added forums to the site. check em out and lemme know what u think. the iframe resizer slows it down just slightly but i think thats better than having to scroll so much...
cracked is offline   Reply With Quote
Old February 24th, 2010, 07:06 AM     #5 (permalink)
Junior Member
 
Join Date: Feb 2010
Posts: 1
SEO Services

This really is a amazing posting, i'm happy I ran across. I've been seeking visitor writters for my blogs so if you ever decide thats something you are interested in please feel free to contact me. I will be back to look at out more of your articles later!

SEO Services
raviraj is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar Color For Iframes magicz69 Webmastering and Programming 14 April 19th, 2008 11:39 AM
Dreamweaver help soulja Webmastering and Programming 2 September 1st, 2004 12:23 AM
Scroll Bar for text Rdaws Graphic Design and Digital Photography 7 June 1st, 2004 10:37 AM
Alternative to using an IFRAME....suggestions? Tekk Webmastering and Programming 4 March 1st, 2004 03:13 AM
how can i embed this? shawshank62 Graphic Design and Digital Photography 2 December 6th, 2003 06:08 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (1083)
Video Card Dilemma (17)
Happy PI Day! (6)
ACORN Workers Indicted for Voter Fr.. (38)
Hopefully the last thread I make be.. (17)
Computer getting hot! (7)
screen cleaner??? (9)
Computer won't turn on (12)
Internet Censorship. (5)
[ F@H Chat] 03/07/10 New Month New.. (50)
Upgrading Video card (17)
Broken Hard Drive (7)
new case and still a werid buzzing .. (9)
TechIMO Signature Policy Update (39)
Recent Discussions
Dell Battery repair (8)
screen cleaner??? (9)
Mac parts question (0)
Nvidia 196.21 and refresh rate (0)
Cool website! (0)
Windows 7 - Do you want to change the.. (0)
Computer won't turn on (12)
Computer getting hot! (7)
ipod fault???? (0)
Notepad won't open (2)
Upgrading Video card (17)
iPod Touch 3rd. Gen (0)
ventrillo not working for others (0)
Windows CE stuck on intranet (0)
wanna run setup switch for VGA adapor.. (1)
Looking for drivers for Toshiba lapto.. (3)
WAN settings (0)
RA2 - Multiplayer not Working (2)
RUN:cmd..... (2)
Bad BIOS checksum. Starting BIOS Reco.. (5)
Internet Censorship. (5)
Mouse not responding (1)
Video Card Dilemma (17)
External hard drive not working on la.. (5)
school report... (1)


All times are GMT -4. The time now is 02:33 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28