Eric Pickup wrote:
I'm having a problem with the following html (I've simplified it down
to a simple test case). Could anyone point out why Mozilla is having
problems with this (I've tried so many variations that I can't think
of any more). In the actual code I have an if statement to handle IE
but I need the code to work in Mozilla and IE.
<HTML>
<BODY>
<IFRAME width="100" height="100" NAME="Composition" ID="Composition">
</IFRAME>
1- There is no src attribute and src attribute value for your iframe here.
2- I strongly suggest you always give different and distinct attribute
values to id and name for several reasons: it helps code readability,
code debugging with debuggers, code review by others. I personally use
prefixing in this manner:
<iframe width="100" height="100" name="nameComposition"
id="idComposition">[Your user agent does not seem to support iframes or
is currently configured not to display iframes. If you're using Opera
6+, you can with File/Preferences...Alt+P/Page style/Enable inline
frames.]</iframe>
<SCRIPT LANGUAGE="JavaScript1.2">
language is a deprecated attribute; type has superseded language and is
both backward and forward compatible. So,
<script type="text/javascript">
<!--
var scrollwindow = document.getElementById("Composition").contentDocu ment;
This is wrong. Your iframe Composition is an element of a page here.
To modify dynamically the content of your iframed document,
I'm almost 100% sure that
var scrollwindow = frames["Composition"].document.body.innerHTML =
"<P>hello</P>";
would work, should work.
var page = "<P>hello</P>";
scrollwindow.body.innerHTML = page;
//-->
</SCRIPT>
</BODY>
</HTML>
Thanks if advance for any help!
Eric
There is a much better way to do what you are attempting to do here.
Many months ago, I wrote a script just achieving what you want to do,
and it works extremely well for MSIE 6 for Windows, Mozilla-based
browsers (17 different browsers), Opera 7 and most likely other W3C web
standards compliant browsers. The code uses only valid W3C markup code,
valid css code and W3C DOM 2 properties and methods.
http://www10.brinkster.com/doctorunc.../MainPage.html
Opera 7 has a bug with disabling button while MSIE 6 for Windows has a
padding issue with iframes.
Don't bookmark the page as I'll probably tune and tweak again the page
and rename the page.
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html