|
RasterWeb: Code: JavaScript > confirmerThis is a simple JavaScript I use to make someone confirm they *really* want to submit a form. I've needed it a few different times. Here's the code:
<script language="JavaScript">
<!--
function confirmer () {
var result;
result = confirm ("Are you sure you want submit this?");
return result;
}
//-->
</script>
Here's the form tag: <form onSubmit="return confirmer()" method="get" action="foo.cgi"> So if you click 'Ok' the JavaScript returns 'true' and the form gets submitted. If not, it's false. As usual, all the JavaScript warnings are in place, use it as you may... Here's a sample page. |
|||||||||||||||
|
Last Modified: 08.17.2000 by rasterboy |
||