表单中单击回车键光标下移
1.用脚本判断点击的是否为回车键
<script type="text/javascript" >
function EnterKeyClick() {
if (event.keyCode == 13) {
event.keyCode = 9;
}
}
</script>
2.前台
<ext:FormLayout ID="FormLayout3" runat="server">
<ext:Anchor>
<ext:TextField ID="txtCoding" runat="server" Enabled="true" FieldLabel="知识编码" Width="260" TabIndex="7" EnableKeyEvents="true">
<Listeners>
<KeyDown Handler="EnterKeyClick();" />
</Listeners>
</ext:TextField>
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="txtDescribe" runat="server" EmptyText="请输入描述" FieldLabel="描述" Width="260" TabIndex="8" EnableKeyEvents="true">
<Listeners>
<KeyDown Handler="EnterKeyClick();" />
</Listeners>
</ext:TextField>
</ext:Anchor>
<ext:Anchor >
<ext:TextField ID="txtAuthor" runat="server" EmptyText="请输入作者" FieldLabel="作者" Width="260" TabIndex="9" EnableKeyEvents="true">
<Listeners>
<KeyDown Handler="EnterKeyClick();" />
</Listeners>
</ext:TextField>
</ext:Anchor>
</ext:FormLayout>
说明:
TabIndex="7" Tab顺序
EnableKeyEvents="true" 执行键事件
KeyDown Handler="EnterKeyClick();" 监听键按下事件并执行EnterKeyClick()方法