我做了个验证码的程序,但点按钮时就没问题,一按回车就清空文本框,请问怎样才可以点按钮和按回车一样的效果。
以下是代码:<?php
session_start();
if($_POST[button]) {
if($_POST[textfield]==$_SESSION[che]){
echo "<script>alert('验证码正确')</script>";
}else{
echo "<script>alert('验证码错误')</script>";
}
}
?>
<form id="form1" name="form1" method="post" action="" onSubmit="">
<img src='bitch.php'><br>
  <label for="textfield"></label>
  <input type="text" name="textfield" id="textfield" />
  <input type="submit" name="button" id="button" value="提交" />
</form>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />