a me non funziona l'ho utilizzo con:

<form name="form1" method="post" onsubmit="return check()" action="test.php">