HighDots Forums  

iframe in IE and Firefox problem

alt.html.dhtml alt.html.dhtml


Discuss iframe in IE and Firefox problem in the alt.html.dhtml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mike888@berlin.com
 
Posts: n/a

Default iframe in IE and Firefox problem - 10-20-2006 , 02:42 AM






I want to create dynamic iframe content like below but in Firefox

<iframe width="100%" height="100" src="#"></iframe>

<script language="JavaScript"><!--
document.frames[0].document.open();
document.frames[0].document.write('THis is the dynamic text for iframe
above');
document.frames[0].document.close();
//--></script>

these document.frames are now working under Firefox, can someone help
me?


Reply With Quote
  #2  
Old   
mike888@berlin.com
 
Posts: n/a

Default Re: iframe in IE and Firefox problem - 10-20-2006 , 02:45 AM







mike... (AT) berlin (DOT) com wrote:
Quote:
I want to create dynamic iframe content like below but in Firefox

iframe width="100%" height="100" src="#"></iframe

script language="JavaScript"><!--
document.frames[0].document.open();
document.frames[0].document.write('THis is the dynamic text for iframe
above');
document.frames[0].document.close();
//--></script

these document.frames are now working under Firefox, can someone help
me?
I mean NOT working under Firefox, only IE, and i want to have it
working under firefox, can someone help me?
thanks.



Reply With Quote
  #3  
Old   
Mark F.
 
Posts: n/a

Default Re: iframe in IE and Firefox problem - 11-02-2006 , 11:09 AM




<mike888 (AT) berlin (DOT) com> wrote

Quote:
I want to create dynamic iframe content like below but in Firefox

iframe width="100%" height="100" src="#"></iframe

script language="JavaScript"><!--
document.frames[0].document.open();
document.frames[0].document.write('THis is the dynamic text for iframe
above');
document.frames[0].document.close();
//--></script

these document.frames are now working under Firefox, can someone help
me?

First, remove the width and height and let CSS format the inline frame.
Assign a unique ID for the element.

<iframe id="myFrame" src=""> </iframe>

Now in the stylesheet you can reference the element's ID with:

#myFrame {
position: relative;
width: 100%;
height: 100%;
}

Next in your JavaScript use:

document.getElementById('myFrame').innerHTML "This is the dynamic text for
the iframe.";

The original purpose of an inline frame was to embed other html documents
within the parent document. I think you are trying to do something
different. If you are simply wanting to display textual content I suggest
using a div in the same manner as described above. If you want it to work
with older browsers then you need to do a little browser sniffing via the
document's onload() event and check for rendering class and version. Create
code specific to each group of browsers.

My code example works with the later versions of Opera, Netscape, MSIE,
Mozilla and FireFox (same engine as NS).

Mark




Reply With Quote
  #4  
Old   
mike888@berlin.com
 
Posts: n/a

Default Re: iframe in IE and Firefox problem - 11-09-2006 , 10:14 PM



Yes, actually i would like to insert html file to the iframe, how can
it be done?

thanks.



Mark F. wrote:
Quote:
mike888 (AT) berlin (DOT) com> wrote in message
news:1161330157.801702.316250 (AT) e3g2000cwe (DOT) googlegroups.com...
I want to create dynamic iframe content like below but in Firefox

iframe width="100%" height="100" src="#"></iframe

script language="JavaScript"><!--
document.frames[0].document.open();
document.frames[0].document.write('THis is the dynamic text for iframe
above');
document.frames[0].document.close();
//--></script

these document.frames are now working under Firefox, can someone help
me?


First, remove the width and height and let CSS format the inline frame.
Assign a unique ID for the element.

iframe id="myFrame" src=""> </iframe

Now in the stylesheet you can reference the element's ID with:

#myFrame {
position: relative;
width: 100%;
height: 100%;
}

Next in your JavaScript use:

document.getElementById('myFrame').innerHTML "This is the dynamic text for
the iframe.";

The original purpose of an inline frame was to embed other html documents
within the parent document. I think you are trying to do something
different. If you are simply wanting to display textual content I suggest
using a div in the same manner as described above. If you want it to work
with older browsers then you need to do a little browser sniffing via the
document's onload() event and check for rendering class and version. Create
code specific to each group of browsers.

My code example works with the later versions of Opera, Netscape, MSIE,
Mozilla and FireFox (same engine as NS).

Mark


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.