writing to a frame - moz

M

mlybarger

i have a popup window that's built from javascript with something like:

source += "<html>";
source += " <head>";
source += " </head>";
source += " <frameset rows='100,*'>";
source += " <frame id='controls' name='controls' />";
source += " <frame id='data' name='data' />";
source += " </frameset>";
source += "</html>";

i'd like to "push" some content into the frames in mozilla. in IE, we
use the following:
popupwindow.document.frames['data'].document.write(source);

but i get an error message that document doesn't exist. i use
mozilla's debugger and surely there's no document object on the frame
object. any ideas on how i can push content into these frames?

thanks!
~mark
 
M

Martin Honnen

i have a popup window that's built from javascript with something like:

source += "<html>";
source += " <head>";
source += " </head>";
source += " <frameset rows='100,*'>";
source += " <frame id='controls' name='controls' />";
source += " <frame id='data' name='data' />";
source += " </frameset>";
source += "</html>";

i'd like to "push" some content into the frames in mozilla. in IE, we
use the following:
popupwindow.document.frames['data'].document.write(source);

but i get an error message that document doesn't exist. i use
mozilla's debugger and surely there's no document object on the frame
object. any ideas on how i can push content into these frames?

I guess it is going to work if you start with
<frame name='data' src='about:blank'>
 
M

mlybarger

i add the src, and it still doesn't seem to work. here's a test html
page. i had to turn off the pop up blocker in moz, as i couldn't figure
out how to unblock a local html file.

<html>
<head>
<script language="javascript">

function init() {
alert( 'begin' );

var traceWindow = null;

try {

var iwinWidth = 320; // width of the new window
var iwinHeight = 600; // height of the new window
var iwinLeft = screen.width - (iwinWidth + 10); //(screen.width /
2) - (iwinWidth / 2);
var iwinTop = 10; //(screen.height / 2) - (iwinHeight / 2);
var sConfig="top=" + iwinTop + ",left=" + iwinLeft +",height=" +
iwinHeight + ",width=" + iwinWidth + ",scrollbars=yes, resizable=yes";
var source;

traceWindow = window.open("","_blank", sConfig);

source = "";
source += "<html>";
source += " <head>";
source += " </head>";
source += " <frameset rows='100,*'>";
source += " <frame id='controls' name='controls'
src='about:blank'/>";
source += " <frame id='data' name='data' src='about:blank' />";
source += " </frameset>";
source += "</html>";

traceWindow.document.write(source);
traceWindow.document.close();

source = "";
source += "<html>";
source += " <head>";
source += " </head>";
source += " <body>";
source += "here";
source += " </body>";
source += "</html>";


traceWindow.document.frames['controls'].document.write(source);

} catch (ex) {

alert(ex);

}


}

</script>
</head>
<body onload="init();">
testing
</body>
</html>
 
M

Martin Honnen

traceWindow.document.frames['controls'].document.write(source);

That needs to be
traceWindow.frames['control'].document.open();
traceWindow.frames['control'].document.write(...);
traceWindow.frames['control'].document.close();
to work with Netscape/Mozilla. Should work that way with IE too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top