473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

problem with iframe resizing 2

Can someone help me here because this is really killing me!

the problem is, i have this javascript code in my aspx page that i want it
to work on almost all browsers, especially opera and safari :

function resize(){
displayFrm = document.getElementById("ifrmDisplay");

innerDoc = (displayFrame.contentDocument) ?displayFrm.contentDocument :
displayFrm.contentWindow.document;

objToResize = (displayFrm.style) ? displayFrm.style : displayFrm;

objToResize.height = innerDoc.body.scrollHeight;
}

the code above gets called every time a new page is loaded inside the iframe
(ifrmDisplay) what its doing is resizing the iframe so it can have the same
size as the page inside it, so i can eliminate the need for vertical
scroller for the iframe, i assumed that it works on opera and IE at the same
time, when i tried it out, it worked on IE but not on opera. after lot of
time in researching how i can get workaround this issue with opera, that is
the best possible solution i have and yet it doesnt work. so i gave up and
asking you if you can help me out here , coz this is jst driving me crazy!

the problem is im not a javascript expert, to be honest i jst started doing
javascripts about two days ago, that is why im in need for help

by the way, here is inner html for the iframe if its any use

<iframe id="ifrmDisplay" style="Z-INDEX: 99; LEFT: 187px; WIDTH: 567px;
POSITION: absolute; TOP: 136px; HEIGHT: 408px" src="" scrolling="no"
onload="resize();">
</iframe>
Jul 23 '05 #1
1 2367
Hello

Some quick thoughts.

You may need to be clearer about what exactly is not working.

Is it that:-

(1) the IFRAME onload event (and resize function) is not firing at
all, or

(2) that the resize function is not working as expected (i.e. the
height is not the desired height)?

1. ONLOAD EVENT

I think (I could be wrong) that Opera does not support the onload
event on the IFRAME element.

It does however I think support the "readyState" property on
documents.

So in Opera, your only way may be to include either:-

(a) Some script within the web page to be loaded in the IFRAME, that
calls the parent method:-

<BODY onload="window.parent.resize('IFRAMEID')">

(b) Monitor the document readyState from the parent using a
setInterval process.

I.e. if (myIFrame.contentWindow.document.readyState=="comp lete"){resize();}

2. IFRAME not resizing properly

The scrollHeight value may not be reliable.

Browsers may vary as to whether they take into account margins around
HTML and BODY elements. So you may need to experiment a little here.

Also, you need to take into account the borders and margins of the
IFRAME element itself.

3. FURTHER READING

A useful page on IFRAMES is:-

http://www.dyn-web.com/dhtml/iframes/

A similar post on another site:-

http://www.ozoneasylum.com/9671&latestPost=true

Julian
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Catherine Lynn Smith | last post by:
I want to know the recommended way to handle scripting of/with containers such as an iframe. I have a page with border-navigation bars on the top/bottom/left/right and I want to use an iframe to...
5
by: Ben | last post by:
Hi, I'm having trouble with the CSS apparently not working fully on the form input fields when inside an iFRAME. The problem is that if I resize the text size on the test.html page(see below)...
4
by: khothikhe | last post by:
can some one help me here coz this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari : ...
5
by: Paul Fi | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari...
2
by: paul | last post by:
HI! I have an script that resizes an iframe and it works fine but now I need to know how to get the iframe size after it has been resized for another task, Below is the iframe resizing script...
1
by: sam | last post by:
Hi all, Hope some expert can help me resolve this. I am using the following code to resize an iframe according to the content in it so that the iframe does not use its scroll bar and uses the...
1
by: Dave | last post by:
Usual apologies if this is old territory. I'm resizing a bunch of iframes on a page to the height of their contained documents. Some of the contained documents contain IMG tags. On IE this...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.