Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-05-2006, 09:47 AM   PM User | #1
jitu78
New Coder

 
Join Date: Sep 2006
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
jitu78 is an unknown quantity at this point
Auto fit iframe to content

Hi All,

I am working on site where I am using iframes for dynamic html files.
Each html file having own length and my iframe height is fixed.

How can I set auto height for each page coming in iframe?


- Jits
globtier.com
__________________
jits
Web 2.0 Expert
jitu78 is offline   Reply With Quote
Old 12-06-2006, 07:09 PM   PM User | #2
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
Give this a try

PHP Code:
<script type="text/javascript">
<!--

moz=document.getElementById&&!document.all
mozHeightOffset
=20

function resize_iframe(){
document.getElementById("iframe_id").height=100 // default heightdocument.getElementById('iframe_id').height=window.frames["iframe_name"].document.body.scrollHeight+(moz?mozHeightOffset:0)
}
// -->
</script>

<iframe width=300 id="iframe_id" name="iframe_name" src="" scrolling="no" frameborder="yes" onload=resize_iframe()></iframe> 
__________________
The silent one.

The most dangerous thing in the world is an idea.
The most dangerous person in the world is the one with an idea.
Mr J is offline   Reply With Quote
Old 12-07-2006, 10:43 AM   PM User | #3
jitu78
New Coder

 
Join Date: Sep 2006
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
jitu78 is an unknown quantity at this point
Quote:
Originally Posted by Mr J View Post
Give this a try

PHP Code:
<script type="text/javascript">
<!--

moz=document.getElementById&&!document.all
mozHeightOffset
=20

function resize_iframe(){
document.getElementById("iframe_id").height=100 // default heightdocument.getElementById('iframe_id').height=window.frames["iframe_name"].document.body.scrollHeight+(moz?mozHeightOffset:0)
}
// -->
</script>

<iframe width=300 id="iframe_id" name="iframe_name" src="" scrolling="no" frameborder="yes" onload=resize_iframe()></iframe> 
I had tried this but not working properly in OPERA browser.

Thanks
- Jits
__________________
jits
Web 2.0 Expert
jitu78 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:40 PM.


Advertisement
Log in to turn off these ads.