J
jeff
I want to press a submit button on a form and then a pop-up Window opens
to process the form data.
I have a form with this HTML code:
<form action="/test.php" method="post" name="testform" onSubmit="newWindowForm('testform')">
And here is the javascript for the top of the page:
function newWindowForm(formname)
{
//alert(formname);
var popUp = window.open ('','popUp','scrollbars=no,resizable=no,width=450,height=350');
document.formname.target = 'popUp';
}
The problem is this line:
document.formname.target = 'popUp';
I've obviously got the syntax wrong. I've checked that the "formname" parameter
is being passed to the javascript, it is. You can test it by using the
"alert(formname);" line to see what it is.
A quick way to fix this is to harcode the formname into the javascript:
document.testform.target = 'popUp';
However, there will be lots of these forms in my website and I want
to use 1 piece of code for each form, instead of coding each javascript.
Can this be done?
Cheers
to process the form data.
I have a form with this HTML code:
<form action="/test.php" method="post" name="testform" onSubmit="newWindowForm('testform')">
And here is the javascript for the top of the page:
function newWindowForm(formname)
{
//alert(formname);
var popUp = window.open ('','popUp','scrollbars=no,resizable=no,width=450,height=350');
document.formname.target = 'popUp';
}
The problem is this line:
document.formname.target = 'popUp';
I've obviously got the syntax wrong. I've checked that the "formname" parameter
is being passed to the javascript, it is. You can test it by using the
"alert(formname);" line to see what it is.
A quick way to fix this is to harcode the formname into the javascript:
document.testform.target = 'popUp';
However, there will be lots of these forms in my website and I want
to use 1 piece of code for each form, instead of coding each javascript.
Can this be done?
Cheers