Forum Moderators: open

Message Too Old, No Replies

javascript and redirecting a page

         

samtran0331

9:43 pm on Nov 9, 2004 (gmt 0)



Hi,
I need a confirmation alert and then if "ok" go to a different page. If "cancel" then stay on the page and do not submit the form. I commented out the 2 true values I've tried; using "this.window.location" and "response.redirect".
If I can't use the true value, is there a way to use the false value to not submit the form?

function confirmDelete(){
if (confirm("Delete this record?"))
{
//this.window.location = "http://www.myURL.com";
//response.redirect ("http://www.myURL.com");
}
else
{
return;
}
}

DrDoc

9:56 pm on Nov 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

You should be able to do something like:

<form onsubmit="return confirm('Delete this record?');">