-
dynamic iframe height
I'm seraching for a way to adapt the height of an iframe to it's contents.
Is this possible? if yes: how?
Thnx in advance
-
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
Nope, i know how to make static iframes, but i need to know how i can make the height dynamic
-
kanu you use java-script ?
-
The properies of nodes in parent window are read-only... so i can't change the bloody height from within the iframe...
-
Height of iframe and its content.
hi i think we can change the height and width of i frame at run time but if u are asking about the height and width of content of iframe i think we cant do this.
if you got how to get access the content of iframe then plz guide me too.
Thanks.
Ali.
-
yea of course you kan using javascript:
Code:
<iframe width=200 height =300 id="fra">
</iframe>
<input type="button" onclick="document.getElementById('fra').height=400;">
click on the button near the ifram and you will see increasing in height by 100px .
-
yeah ali_ggl, thats what i'm starting to think to.
@ Amahdy:
I know how to change the seize of an iframe, thats not my problem. But if i do it like in your example, then it'll always get an height of 400px. Problem with that is that it looks kinda nub when the content page has only one line of text. So i want the height to be dependent on the content of the iframe...
-
you kan adjust it onchange() ... and this kould be easily changed to anything .. for example :
document.getElementById('fra').height=document.getElementById('fra').height+100
you kan work around it to make it closely appropriate and change when there is new line ...
-
That will just increase the height with 100px, again not dependant on the iframe contents
Or am i missing something?
-
yea i told you in the onchange I meant after loading the page for example .. try to adjust the height by some scripting depending on the framed page ... this won't be very correct sometimes that's why I said "closely appropriate" ... this may help a bit ...
-
Yeah, i can do it like that, but i don' think it's the way this problem should be solved.
Anyone another idea?
-
Play around with this
Code:
<HTML>
<Head>
<Script type="text/javascript">
function adjustFrame(){
window.frames.IFrame1.scrollBy(0,900);
currTop = window.frames.IFrame1.document.body.scrollTop;
if (currTop > 0)
{
currHeight = document.getElementById('dynFrame').getAttribute('height');
currHeight++;
document.getElementById('dynFrame').setAttribute('height',currHeight);
adjustFrame();
}
}
function setHeight(){
document.getElementById('dynFrame').setAttribute('height',0);
adjustFrame();
}
</Script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></Head>
<Body>
<IFrame
Name = 'IFrame1'
Id ='dynFrame'
Src = 'http://www.settmedia.no/nidaros/phpBB2/'
onload = 'setHeight()'
marginwidth = '0'
marginheight ='0'
frameborder = '0'
vspace = '0'
hspace = '0'
Width = '750'
Height = '150'>
</IFrame>
</Body>
</HTML>
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
Similar Threads
-
By johnw182 in forum ASP.NET
Replies: 0
Last Post: 02-09-2008, 06:02 PM
-
Replies: 1
Last Post: 04-20-2007, 08:07 PM
-
By rcpilotp51 in forum VB Classic
Replies: 0
Last Post: 07-19-2005, 12:25 PM
-
Replies: 1
Last Post: 08-19-2002, 06:18 PM
-
By Chris reid in forum Java
Replies: 3
Last Post: 02-11-2001, 08:17 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks