精神病治疗:表单中,的问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 16:51:26
我的
<form>
<input tabIndex="1" type="text" name="inputxinghao" style="BORDER-RIGHT: #b4b4b4 1px double; BORDER-TOP: #b4b4b4 1px double; BORDER-LEFT: #b4b4b4 1px double; COLOR: #8888aa; BORDER-BOTTOM: #b4b4b4 1px double; BACKGROUND-COLOR: #ffffff" size=10 > </td>
<td width="46%" align="center"><select name="selecta" size="1" tabIndex="2">
<option value="1" selected>新型号</option>
<option value="0">旧型号</option>
</select><div align="center"></div></td>
</tr>
<tr align="center" valign="bottom">
<td height="25" colspan="2"><input tabIndex="3" src="../image/index-12.gif" width="43" height="24" type="image" name="tijiao" onclick="javascript: return CheckForm();"></td>
</tr>
</table>
</form>
表单中怎么样一按回车就能提交,我这个只能鼠标点击,按回车没反应?????

<select name="selecta" size="1" tabIndex="2" onkeydown="checkkey()">
然后在上面javascript中再添加一个function checkkey()用来检查按下的键,如果是回车就调用提交过程.

你要加一个事件,当按下回车时,就提交到javascript: return CheckForm();
这样就可以了

在form中加一个事件onkeydown, 判断健值, 如果是回车健就提交表单, 试试:

<form action=search.asp onkeydown="if(event.keyCode==13) document.all.form1.submit();" name=form1><input tabIndex="1" type="text" name="inputxinghao" style="BORDER-RIGHT: #b4b4b4 1px double; BORDER-TOP: #b4b4b4 1px double; BORDER-LEFT: #b4b4b4 1px double; COLOR: #8888aa; BORDER-BOTTOM: #b4b4b4 1px double; BACKGROUND-COLOR: #ffffff" size=10 > </td>
<td width="46%" align="center"><select name="selecta" size="1" tabIndex="2">
<option value="1" selected>新型号</option>
<option value="0">旧型号</option>
</select><div align="center"></div></td>
</tr>
<tr align="center" valign="bottom">
<td height="25" colspan="2"><input tabIndex="3" src="../image/index-12.gif" width="43" height="24" type="image" name="tijiao" onclick="javascript: return CheckForm();"></td>
</tr>
</table>
</form>