submit.asp
-----------------------
<form action="submit_check.asp" method='post' id=form1 name=form1 >
<table width="100%" border="0" bgcolor="#ffd8b0" cellspacing="2" cellpadding="0" height="34">
  <tr> 
    <td width="153" bgcolor="#ffffe6" height="31"><font color="#FF040B">SAP CODE</font></td>
    <td width="187" bgcolor="#fff9ec" height="31"><input name="sap_code" class="inputbpcsform" id="sap_code" maxlength="30"></td>
    <td width="147" bgcolor="#ffffe6" height="31"></td>
    <td width="264" bgcolor="#fff9ec" height="31">&nbsp;</td>
  </tr>
 </table>
<input type="submit" name="Agree"  value="Submit" style="width:60px;border:1px solid rgb(150,150,150);font-size:12px" onclick="return check_sap()">
</form>
-----------------------
要求:sap_code必须是8位数字
还要对sap_code进行实时验证,即如果填入的数字在表tbl_sap中如果有,则alert("已有该号码");不能提交submit.asp页面
请问js高手们这个check_sap()函数该这么写啊?