当前位置:Gxlcms > JavaScript > js光标定位文本框回车表单提交问题的解决方法_javascript技巧

js光标定位文本框回车表单提交问题的解决方法_javascript技巧

时间:2021-07-01 10:21:17 帮助过:23人阅读

本文实例讲述了js光标定位文本框回车表单提交问题的解决方法。分享给大家供大家参考。具体分析如下:

当光标定位在辅助查找的文本框后回车,页面会出现方法的返回的json串。

原因:When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form.

翻译一下:当form中只有一个input type="text"时,当用户按回车键会提交这个form。

解决方案:对input text的onkeydown事件做处理,禁止回车操作。

具体代码:

希望本文所述对大家的javascript程序设计有所帮助。

人气教程排行