submit to iframe in new window

M

mike

I have a page and when the user clicks a button I want to open up a new
window that has an iframe in it and I want to direct the page to submit
to that iframe.

My code looks like:

var mywin;
mywin =
window.open('','view_report','width='+mywidth+',height=425,top=50,left=0,scrollbars=yes,toolbar=yes,resizable=yes');

mywin.document.write("<html><title>my report</title><body>");
mywin.document.write("<iframe src='tmp.cfm' name='miketest'
id='miketest' height='100%' width='100%'></iframe>");
mywin.document.write("</body></html>");

document.report.method = 'post';
var post_script = mywin.document.getElementById('miketest');
document.report.target = post_script;
document.report.submit();

This does not work but I think you get the jest of it.

Any help is appreciated.

Mike
 
M

mike

I also tried:

var post_script = mywin.frames['miketest'];

I get 2 windows open up so document.report.target is not getting
set properly.

I forgot to mention that i had set:

document.report.action = another.cfm

Mike
 
T

Thomas 'PointedEars' Lahn

mike said:
var mywin;
mywin =
window.open('','view_report','width='+mywidth+',height=425,top=50,left=0,scrollbars=yes,toolbar=yes,resizable=yes');

mywin.document.write("<html><title>my report</title><body>");

Trying to open new windows: Bad Thing.
Accessing properties without feature-testing: Worse Thing.
Calling methods without feature-testing: Worst Thing.
Not reading any newsgroup or documentation before coding: insane.

function isMethodType(s)
{
return (s == "function" || s == "object");
}

var d;
if (mywin && !mywin.closed
&& (d = mywin.document)
&& isMethodType(typeof d.write))
{
mywin.document.write("<iframe src='tmp.cfm' name='miketest'
id='miketest' height='100%' width='100%'></iframe>");
mywin.document.write("</body></html>");

Do not call HTMLDocument::write() consecutively if the written markup
belongs together. Such is inefficient and, more important, error-prone.

HTMLDocument::eek:pen() and HTMLDocument::close() are missing. The generated
document will not be Valid HTML. The generating document is not Valid HTML
iff this code is used as content of the `script' element as ETAGO
delimiters ("</") are not properly escaped ("<\/").

d.open();
d.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n'
+ ' "http://www.w3.org/TR/html4/loose.dtd">\n'
+ '<html>\n'
+ ' <head>\n'
+ ' <meta http-equiv="Content-Type"'
+ ' content="text/html; charset=ISO-8859-1">\n'
+ ' <title>my report<\/title>\n'
+ ' <\/head>\n'
+ ' <body>'
+ ' <iframe src="tmp.cfm" name="miketest" height="100%"'
+ ' width="100%"><\/iframe>'
+ ' <\/body>\n'
document.report.method = 'post';
var post_script = mywin.document.getElementById('miketest');
document.report.target = post_script;

`post_script' has to refer to a string value, as the value of the `target'
property/attribute has to be one. Both standards compliant and backwards
compatible referencing is

document.forms['report'].target = 'miketest';

document.report.submit();

This does not work [...]

"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>


HTH

PointedEars
 

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

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top