PDA

View Full Version : close window automatically



courtney
06-22-2007, 09:04 PM
hello there. i posted this in the "Looking for such a script or service" thread, but i figured it couldn't hurt to ask here too. my apologies if this is frowned upon.

i have a form that has to post to two different places, and i have a script that does it. only problem is, it has to open a new window to do all the form processing, and i would like that window to close automatically. i'm hoping that all i have to do is add a command to the script that tells it to close the window once the form is processed. here's the script:

<script>
<!--
function submitToTP()
{
document.form.action =
"https://www.topproduceronline.com/LeadToolkit.asp"
document.form.target =
"onewindowname"
document.form.submit();
}
function submitToFORM()
{
document.form.action =
"http://www.newhomeconnection.com/forms/fm-test.php"
document.form.target =
"onewindowname"
document.form.submit();
}


if anyone has any ideas, i would really appreciate the help!

thanks!

alexjewell
06-22-2007, 10:35 PM
use window.close();

courtney
06-25-2007, 09:56 PM
thanks!

but where do i put it? i've tried putting it at the end of script, and at the end of each section of the script, and so far it's not working. i don't really know java, so i'm flying blind here!

tech_support
06-26-2007, 06:59 AM
function submitToTP()
{
document.form.action =
"https://www.topproduceronline.com/LeadToolkit.asp"
document.form.target =
"onewindowname"
document.form.submit();
window.opener=self //To stop IE (except IE7) asking to close a window
window.close() //Bang! And it's gone.
}
function submitToFORM()
{
document.form.action =
"http://www.newhomeconnection.com/forms/fm-test.php"
document.form.target =
"onewindowname"
document.form.submit();
window.opener=self //To stop IE (except IE7) asking to close a window
window.close() //Bang! And it's gone.
}

courtney
06-26-2007, 02:48 PM
thank you so very much!

i really do appreciate the help.