•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 362,339 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,656 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 8335 | Replies: 4
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
When i try to dynamically change the height of an iframe in ie through
a java-script to match its content (a html page containing a flash
movie), it doesn't resize the iframe at first, but when i reload the
same page into the iFrame it resizes as planned, how come? Any ideas?
This script works well in firefox, safari and netscape, but i cant get
it to work in ie(8, 7). And i get the same problems with every
resizing script i've tried.
This is the script i use:
<script type="text/javascript">
function adjustIFrameSize(iframe)
{
if ( iframe.contentDocument ) // firefox
{
iframe.height = iframe.contentDocument.height;
}
else // IE
{
iframe.style.height =
iframe.contentWindow.document.body.scrollHeight;
}
}
</script>
The iframes:
<iframe src="centriaMenu.php" name="menu" WIDTH="800" HEIGHT="200"
hspace="0" frameborder="0" marginheight="0" marginwidth="0"></IFRAME>
<iframe src="<?php print $_POST[fileName]?>" name="contents"
onload="adjustIFrameSize(this);" id="contents" height="200"
WIDTH="800" frameborder="0" marginheight="0" marginwidth="0" ></
IFRAME>
I have a flash menu in the first iframe, the buttons on the menu uses
getURL(siteToLoad, "contents") to load another html-page into the
iframe "contents".
Is it possible to make the iFrame refresh automatically though
javascript so that i just refreshes the iframe once? Everytime ive
tried that it just ends up in a never ending refresh-loop... How can i
make this work? Is there any better script for resizing (and
refreshing after resize) the iframe height so that it matches to its
content? Please, i've been stuck with this problem for some days
now...
// Max
a java-script to match its content (a html page containing a flash
movie), it doesn't resize the iframe at first, but when i reload the
same page into the iFrame it resizes as planned, how come? Any ideas?
This script works well in firefox, safari and netscape, but i cant get
it to work in ie(8, 7). And i get the same problems with every
resizing script i've tried.
This is the script i use:
<script type="text/javascript">
function adjustIFrameSize(iframe)
{
if ( iframe.contentDocument ) // firefox
{
iframe.height = iframe.contentDocument.height;
}
else // IE
{
iframe.style.height =
iframe.contentWindow.document.body.scrollHeight;
}
}
</script>
The iframes:
<iframe src="centriaMenu.php" name="menu" WIDTH="800" HEIGHT="200"
hspace="0" frameborder="0" marginheight="0" marginwidth="0"></IFRAME>
<iframe src="<?php print $_POST[fileName]?>" name="contents"
onload="adjustIFrameSize(this);" id="contents" height="200"
WIDTH="800" frameborder="0" marginheight="0" marginwidth="0" ></
IFRAME>
I have a flash menu in the first iframe, the buttons on the menu uses
getURL(siteToLoad, "contents") to load another html-page into the
iframe "contents".
Is it possible to make the iFrame refresh automatically though
javascript so that i just refreshes the iframe once? Everytime ive
tried that it just ends up in a never ending refresh-loop... How can i
make this work? Is there any better script for resizing (and
refreshing after resize) the iframe height so that it matches to its
content? Please, i've been stuck with this problem for some days
now...
// Max
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Dynamic iframe height (JavaScript / DHTML / AJAX)
- iframe height (HTML and CSS)
- iframe help - Height (HTML and CSS)
- Dynamic iframe height ? (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Help with making decimals show up always
- Next Thread: Style is Null or not an Object



Threaded Mode