Entry
How to submit a FORM to a new window with certain features set?
Feb 13th, 2000 06:53
Martin Honnen,
You can submit a FORM to a new window with
<FORM TARGET="_blank" ...>
but that newly opened window has the standard dimensions and features.
If you want to set the features of the window then use the onsubmit
handler to open a window with a certain name and the desired features
first, then set the FORM's TARGET to the window name before submitting
the FORM:
<SCRIPT>
function openTarget (form, features, windowName) {
if (!windowName)
windowName = 'formTarget' + (new Date().getTime());
form.target = windowName;
open ('', windowName, features);
}
</SCRIPT>
<FORM ACTION="whatever"
ONSUBMIT="openTarget
(this, 'width=300,height=300,resizable=1,scrollbars=1'); return true;"
>
The openTarget function needs at least two arguments, without the third
it always opens a new window (like target _blank) but you can provide a
third argument for the window name to reuse the window later.