By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Writing to an iFrame

P: n/a
I have an existing page that dynamically creates data in a popup
window. I am trying to change it to use an iFrame. Is the following
code valid:

The iFrame is as follows
<iframe src="theframe.html" name="theframe"></iframe>
"theframe.html" is an existing file initially with instructions.

In a script I do
thewindow=window.open("","theframe");
thewindow.document.open();
thewindow.document.write("Some Requested Data");
thewindow.document.close();

This is done multiple times depending on what the user requests each
time. Sometimes this works and sometimes it doesn't. I'm probably doing
someing very wrong but I don't know where to look for reference.

I'm not really opening a window so there must be another way to do it.

What is the best way to write to an iFrame or should I not even try?

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Dennis M. Marks" <de******@dcsi.net> writes:
<iframe src="theframe.html" name="theframe"></iframe> In a script I do
thewindow=window.open("","theframe");
thewindow.document.open();
thewindow.document.write("Some Requested Data");
thewindow.document.close(); This is done multiple times depending on what the user requests each
time. Sometimes this works and sometimes it doesn't.
Bugger! I hate it when it does that.
Do you see any error messages? Do you have error messages turned on?
It could be that the url "" isn't accepted as coming from the same
domain as your page.
I'm not really opening a window so there must be another way to do it.
Try
var thewindow = window.frames['theframe'];
instead of window.open.
What is the best way to write to an iFrame or should I not even try?


I would use the frames collection instead of window.open, but otherwise
it looks fine.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
@SM
"Dennis M. Marks" a ecrit :
I have an existing page that dynamically creates data in a popup
window. I am trying to change it to use an iFrame. Is the following
code valid:

The iFrame is as follows
<iframe src="theframe.html" name="theframe"></iframe>
"theframe.html" is an existing file initially with instructions.

In a script I do
thewindow=window.open("","theframe");
thewindow=parent.theframe;
or
thewindow=parent.frames['theframe'];

or (if page is in a framed page, itself in a fram of main page)
thewindow=top.theframe;
thewindow.document.open();
thewindow.document.write("Some Requested Data");
thewindow.document.close();


variant :
TW = parent.theframe.document;
TW.open();
TW.write("Some Requested Data");
TW.close();
--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.