首页 > 代码库 > html(jsp)如何实现对form提交前进行确认

html(jsp)如何实现对form提交前进行确认

<html>
 <head>
  <title>Validator</title>
  <script type="text/javascript">
   function checkForm() {
    if (window.confirm("Are you sure you want to sumbit this form?")) {
     return true;
    }
    return false;
   }
  </script>
 </head>
 <body>
  <form action="2.html" onsubmit="return checkForm()">
   Please click the submit button:<br>
   <input type="text" name="text" value="http://www.mamicode.com/text"><br>
   <input type="submit">
  </form>
 </body>
</html>

html(jsp)如何实现对form提交前进行确认