473,327 Members | 2,074 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,327 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):
http://ww-chat.com/games.php

This is the page without a doctype (Works properly only on FIREFOX - not IE):
http://ww-chat.com/games-nodoctype.php


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:
http://ww-chat.com/iframeresize.js


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

Thanks,
Worldwideebm
Sep 28 '09 #1
10 3418
Can anyone help me on this problem?
Oct 1 '09 #2
acoder
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
Dormilich
8,658 Expert Mod 8TB
@worldwideebm
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){
try{
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 10px;
}
catch(err){
window.status = err.message;
}
}

Any ideas why it wouldn't work?
Oct 1 '09 #6
Plater
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; 
  6.  
Expand|Select|Wrap|Line Numbers
  1. Error: initMenu is not defined
  2. Source File: http://ww-chat.com/games-nodoctype.php
  3. Line: 3
  4.  
Try doing this:
objToResize.height = (innerDoc.body.scrollHeight + 10)+"px";
Oct 1 '09 #7
THANK YOU SO MUCH!
That worked! =]

Thanks to every who replied =]
Oct 1 '09 #8
Plater
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
drhowarddrfine
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

1
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...
3
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">...
6
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,...
2
by: swathi | last post by:
----------------------------------------------------------------------- A poll associated with this post was created, to vote and see th results, please visit...
6
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...
16
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");...
22
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...
14
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>
3
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.