Fernie
I am submitting data using Javascript as follows:
You shouldn't be. What is wrong with simply letting the browser submit the
form. That is what forms are for.
...
f.submit();
f.target="_blank";
This is incorrect. See below.
My problem is that I don't know how to keep the original page from showing
the cgi result. Please see the following example and you will see exactly
what I mean:
http://66.235.178.180/
I would sincerely appreciate it if someone could help me so that the
original page does not change.
Consider what happens when a viewer presss that submit button.
Your onSubmit handler is called. This calls function sendForm which does a
couple of things and submits the form, with f.submit(). That's right, the
form is submitted at this point. The results of this submit will appear in
*this* page.
Then the sendForm changes the target of the form. Control then passes back
to the onSubmit handler which does *not* return false. This indicates to the
browser that the form submit should proceed. The browser submits the form
again, this time with target="_blank". You get two hits on the server and
two pages returned.
Why are you doing this anyway? If your viewer has popup windows disabled
they will never see the second window.
If you insist on using a popup window then what is wrong with letting the
browser submit the form normally but specify target="_blank" in the form.
You seem to be jumping through all sorts of javascript hoops to make the
browser do what it can do anyway
The fix to your hoop is to reverse the order of the two lines above and to
return false from the onSubmit handler.
BTW you are using some IE specific things in there. There is a very good
chance this page will break in other browsers.