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

Doctype is breaking my iframe in mozilla

This is a problem that i have googled for hours and can't find an answer so i resort to asking on here because i found similar question on here.

I have a page i use, It has an iframe on it but it is not regular iframe, The iframe has a resizing script that resizes the height of the iframe to the height of the page being viewed. Using this script it eliminates scrolling!

This has all been working out great but then i realise for it to function properly in IE i need to add a doctype, When i add a doctype to it it functions properly in IE but it doesn't work in firefox. In firefox the frame doesnt resize and it is like 50px height.
I have tried a bunch of different doctypes and they don't work.

This is the problem page (with doctype - works properly only on IE):

This is the page without a doctype (Works properly only on FIREFOX - not IE):

This is the code that i use for the iframe:

<iframe id="games" name="games" src="http://ww-chat.com/games/" frameborder=0 scrolling=no width="990" onload="if (window.parent && window.parent.autoIframe) {window.parent.autoIframe('games');}"></iframe>

This is the script that it uses to resize the frame:

I have other iframes on my website which don't use the resize script and they work perfectly fine (with doctype!).

Sep 28 '09 #1
10 3416
Can anyone help me on this problem?
Oct 1 '09 #2
16,027 Expert Mod 8TB
You should look at getting rid of these errors.

Anyhow, the problem seems to be because you've forgotten the units when setting the height. Add "px" to the height setting.
Oct 1 '09 #3
Hey, I'm not very good at this but where exactly should I put px?

I have tried placing it after 990 (the width) and i have tried placing px after 10 (in the script) and neither of those fixed it.

Any ideas?

Btw the resize script isn't mine..
Oct 1 '09 #4
8,658 Expert Mod 8TB
every numerical value (except 0) requires a unit in CSS.
Oct 1 '09 #5
I have tried putting px after both numbers and it doesn't fix. I don't know what could cause this, it only happens when i put the doctype in (because it wont work in IE without doctype, but the height doesn't work in firefox if i use doctype) I don't use CSS for anything on the iframe so it can't be css.

Here is what my iframe page is:

<iframe id="games" name="games" src="http://ww-chat.com/games/" frameborder=0 scrolling=no width="990px" onload="if (window.parent && window.parent.autoIframe) {window.parent.autoIframe('games');}"><p>Your browser does not support Iframes, People upgrade to a compatible browser.</p></iframe>
Here is the script that resizes my iframe:
function autoIframe(frameId){
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 10px;
window.status = err.message;

Any ideas why it wouldn't work?
Oct 1 '09 #6
7,872 Expert 4TB
Neither of those two links in the first post worked for me in IE or in FF.
Your javascript has errors.
Expand|Select|Wrap|Line Numbers
  1. Error: missing ; before statement
  2. Source File: http://ww-chat.com/iframeresize.js
  3. Line: 6, Column: 50
  4. Source Code:
  5. objToResize.height = innerDoc.body.scrollHeight + 10px; 
Expand|Select|Wrap|Line Numbers
  1. Error: initMenu is not defined
  2. Source File: http://ww-chat.com/games-nodoctype.php
  3. Line: 3
Try doing this:
objToResize.height = (innerDoc.body.scrollHeight + 10)+"px";
Oct 1 '09 #7
That worked! =]

Thanks to every who replied =]
Oct 1 '09 #8
7,872 Expert 4TB
Now both your links work in IE and FF.
All fixed?
Oct 1 '09 #9
Yes =]

But there is another problem.. But i might start a new thread for it?

I don't think that it is related to this problem..
Oct 1 '09 #10
7,435 Expert 4TB
It should be noted that you will never get IE to attempt to perform like the other more modern browsers without a proper doctype. ALL new web pages are required to have one.
Oct 2 '09 #11

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

Similar topics

by: Jeff Thies | last post by:
I'm (still) having trouble reading the contents of an IFRAME (IE5). I have this: var my_iframe = document.frames; What I would want to do at that point is get either the...
by: alejandro.rivero | last post by:
In Mozilla, the following code seems to resize correctly the IFRAME, so no scroll bars: <iframe marginwidth=0 marginheight=0 src=text.html onload="this.height= this.contentDocument.height">...
by: Patrick | last post by:
Hi I am fairly new to CSS and the web.I am trying to build a site more to practice my skills than for the site itself. I have been focusing on CSS and try my best to make it work in I.E 6.0,...
by: swathi | last post by:
----------------------------------------------------------------------- A poll associated with this post was created, to vote and see th results, please visit...
by: Randell D. | last post by:
Folks, I've spent the past hour or so testing IFRAME with Mozilla 1.7.5 and not getting it to work - Then... I thought I'd try it in IE, and my code worked... Thus... is IFRAME an IE only...
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe");...
by: stevenkobes | last post by:
If a word has a hyphen in it, IE will permit a line break at the hyphen, but Firefox/Mozilla won't. Apparently the Firefox behavior is standards-compliant, but it is not what I want. Is there a...
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
by: tullyrob | last post by:
If you run the following simple line of code in Mozilla the webpage loads fine. However, a default page is displayed when opened in IE. --- <html> <iframe name=stbbox...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.