473,395 Members | 1,631 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,395 software developers and data experts.

iframe problem

I am trying to make my company's website viewable thru multiple browsers and I'm running into some issues. The site contains an iframe where the content for each link is displayed when navigating the website similar to a traditional frames page. I have coded so when a new page is loaded in the iframe then it runs thru a function that resizes the main page containing the iframe. My code works fine for IE but not for Firefox and I haven't tried any other browsers yet. Here is the code that works for IE:

function adjust_page(){
menuadjust = 144
minheight = 500
contentheight = page.document.body.scrollHeight
ShowOptions()
if(contentheight < minheight){
page.frameElement.style.height = minheight
navmenu.style.height = minheight - menuadjust - 30
}
else{
page.frameElement.style.height = contentheight
navmenu.style.height = contentheight - menuadjust - 30
}
}


The bold section is where Firefox is complaining, saying "page.document has no properties". It also says "Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.". Does anyone have a simple answer to fix the above code so that it works for Firefox and continues to work in IE as well. Any help would be greatly appreciated.

Matt
Jan 10 '07 #1
3 1626
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1.  
  2. function adjust_page(){
  3. menuadjust = 144
  4. minheight = 500
  5. contentheight = document.body.scrollHeight
  6. ShowOptions()
  7. if (contentheight < minheight) {
  8. document.getElementById("id of the frame").style.height = minheight
  9. navmenu.style.height = minheight - menuadjust - 30
  10. } else {
  11. document.getElementById("id of the frame").style.height = contentheight
  12. navmenu.style.height = contentheight - menuadjust - 30
  13. }
  14. }
  15.  
  16.  
Jan 10 '07 #2
Thanks for the quick response but that doesn't work 100%. I need to know the height of the iframe's content.

contentheight = document.body.scrollHeight

This does not look at the content height of the iframe but rather the height of the page that contains the iframe.
Jan 10 '07 #3
iam_clint
1,208 Expert 1GB
ahh i see what your getting at
document.getElementById("iframe id").scrollHeight

this may give you want you were wanting
Jan 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
12
by: wangzx | last post by:
I am the author of easyajax.sourceforge.net, and I have a problem on Firefox 1.5, I post the problem here and hopes somebody help me. The test page can be:...
26
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
1
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building...
7
by: nicknack | last post by:
Hi. I have a strange problem wuth IFRAME. I have page aaa.aspx with an IFRAME that contain page bbb.aspx. page bbb.aspx sometimes redirect him self to page ccc.aspx. The problem is that...
0
by: mem | last post by:
Hello, I'm a novice at this and am trying to solve a problem reference IFrame. The following code is for a page I've created. It works well with two exceptions. The IFrame is an application hosted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.