Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirm box when pressing a Submit button

Status
Not open for further replies.

monkeymagic2222

Technical User
May 13, 2002
78
GB
Hi,

I have an asp web page with one form on it but two Submit buttons (each posting the data to a different page. The first Submit button has the following JavaScript code:

<input type=&quot;submit&quot; name=&quot;submit1&quot; value=&quot;Submit&quot; onClick=&quot;document.theform.action='ordernum_update_code.asp';&quot;>

This works perfectly as is and I do need to keep the onClick code in it. What I would like to do is bring up a new box that asks if the user is sure they want to continue and if they press yes, the above action will be carried out and if they press no, nothing will happen?

Thanks in advance.
 
<script>
function confrm()
{
if(confirm(&quot;Do u wanna do this?&quot;))
document.theform.action='ordernum_update_code.asp'
else
alert(&quot;Cancelled.&quot;)
}
</script>
<input type=&quot;submit&quot; name=&quot;submit1&quot; value=&quot;Submit&quot; onClick=&quot;confrm()&quot;>


Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top