请大家指教一下我这个计数页面 (键盘enter事件问题)
现在的问题是:按回车键不会计数要想做到的是按下回车键除了跳转下一个INPUT外,也会自动计算
先谢谢~
<!--#include virtual="index/conn2.asp"-->
<SCRIPT LANGUAGE="JavaScript">
<!--
function onkeydown()
{
if(event.keyCode == 13){ event.keyCode =9; }
}
function sumValue()
{
if (document.getElementById("x1").value=="")
a=0
else
a=document.getElementById("x1").value;
if (document.getElementById("x2").value=="")
b=0
else
b=document.getElementById("x2").value;
if (document.getElementById("x3").value=="")
c=0
else
c=document.getElementById("x3").value;
sum=parseInt(a)+parseInt(b)+parseInt(c)
document.getElementById("zxz").value=sum;
return false;
}
//-->
</SCRIPT>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计数</title>
<link href="../hover.css" rel="stylesheet" type="text/css">
</head>
<body background="../images/one.gif" topmargin="0" onMousedown="sumValue()">
<form name="form1" method="post" action="">
<table border="0" align="center" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
<table border="0" align="center" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
<table height="30" align="center" cellspacing="0">
<tr>
<td><div>1<input name="x1" type="text" onkeydown="if(event.keyCode==13)event.keyCode=9" onClick="sumValue()"></div></td>
<td><div>2<input name="x2" type="text" onkeydown="if(event.keyCode==13)event.keyCode=9" onClick="sumValue()"></div></td>
<td><div>3<input name="x3" type="text" onkeydown="if(event.keyCode==13)event.keyCode=9" onClick="sumValue()"></div></td>
</tr>
</table>
<p> </p>
<table border="0" align="center" cellspacing="0">
<tr>
<td><div align="center"><input name="zxz" type="text" class="int" id="zxz" size="15" >元</div></td>
</tr>
</table>
</form>
</body>
</html>