用Checkform()递交呢?
onkeydown="if(event.keyCode==13) Checkform()"
function Checkform(){
//do check
document.form1.submit();
}
onkeydown="if(event.keyCode==13) Checkform()"
function Checkform(){
//do check
document.form1.submit();
}
function Checkform(){
if(false)return false;
return true;
}
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script language="JavaScript">
<!--
check = function ()
{
userid = document.all.UserID.value;
if(isNumber(userid))
{
return true;
}
else
{
alert('数字');
return false;
}
}
function isNumber(s){
return !isNaN(s);
}
//-->
</script>
<body>
<form name="form1" method="post" action="Login.asp" onkeydown="if(event.keyCode==13 && check())this.submit();">
<tr valign="bottom">
<td height="41" colspan="3"><span class="style4"><span class="style5"> 按回车登陆</span></span></td>
<td height="41" align="right"><span class="style5"><span class="style6"></span></td>
</tr>
<tr>
<td width="49" height="50" class="style3"> <strong>编号:</strong></td>
<td width="96"><input name="UserID" type="text" class="Put2" id="UserID2" value="" size="16"></td>
<td width="48" align="center" class="style3"><strong>密码:</strong></td>
<td width="116" align="right"><input name="Password" type="password" class="Put2" id="Password" size="18"></td>
</tr>
</form></body>