codice:
<html>

  <head>
    <script type="text/javascript">
    <!--

      function checkDate (txt)
      {
        var format = /^\d{2}\/\d{2}\/\d{4}$/;
        if (txt.match (format) == null) {
          alert ("Data non in formato \"gg/mm/aaaa\".");
          return false;
        } else
          return true;
      }

    //-->
    </script>
  </head>

  <body>
    <form action="javascript:void(0)" onsubmit="return checkDate(this.elements['data'].value);">
      Data: <input type="text" name="data" value="" maxlength="10" /> <input type="submit" />
    </form>
  </body>

</html>