我确实在Web项目中将关键工作作为选项卡输入了,现在在提交按钮上反之亦然 [英] i did enter key work as tab in web project now wana vice versa on submit button

查看:71
本文介绍了我确实在Web项目中将关键工作作为选项卡输入了,现在在提交按钮上反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实在Web项目中将关键工作作为选项卡输入了它,就像按回车键一样工作正常,将焦点移到了下一个控件,但是当焦点移到提交"按钮时,我想更改它,如果我按了Enter键,那么它必须提交页面或表格
我做到了

i did enter key work as tab in web project it works fine as a press enter key it shifted focus to next control but when focus comes to Submit button i want to change it and if i pressed enter key then it must submit page or form
i did it like

<body onunload="if(screenTop >9999) windows.location.href('LoginPage.aspx');" onkeydown="javascript:if(event.keyCode==13){event. keyCode=9;}">


在母版页中.
请帮助我.


in master page.
plz help me.

推荐答案

尽管您所做的工作并不很有意义,但是如果您需要按要求的流程,您是否尝试附加onkeydown事件在您的提交按钮上,它将覆盖先前定义的onkeydown?您需要做的就是覆盖并取消事件冒泡.提交按钮将按其正常行为工作.

试试:
Though what you are doing is not suggestible, yet if you need the flow as you asked, did you try to attach a onkeydown event on your submit button that will override the onkeydown defined earlier? All you need is to override and cancel the bubbling of event. Submit button will work as its normal behavior.

Try:
<input type="submit" onkeydown="javascript:event.cancelBubble=true;"/>


如上所述,您不应这样做.有一个按钮有时会做一件事而在其他时候会做另一件事对用户来说非常混乱.单个按钮只能执行一项功能.
As stated, you should not do this. Having a button that does one thing sometimes and another thing at other times is very confusing to users. A single button should perform one function only.


这篇关于我确实在Web项目中将关键工作作为选项卡输入了,现在在提交按钮上反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆