如何在jsp中使用keypress事件 [英] how to use keypress event in jsp

查看:215
本文介绍了如何在jsp中使用keypress事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用java,html,jsp并且我想将光标从一个文本框移动到另一个文本框中,一旦用户输入第一个值,光标应该继续到下一个字段的相应值,即我必须分配

i am using java,html,jsp in my project & i want to move the cursor from one textbox to another & as soon as the user enters the first value, the cursor should go on to next field the coresponding value which i have to assign

推荐答案

根据您的要求,我可以做出以下步骤。

From your requirement I can make out the following steps.


  1. 确定您何时想要专注于第二个 TextBox 的标准。

    例如 - 当 MaxLength 到达时,焦点将转到第二个 TextBox

  2. 使用 javaScript onkeypress事件 [ ^ ]第一个 TextBox 并调用一个函数。
  3. 在该函数上,检查条件/条件是否满足,只需使用 HTML DOM focus()方法 [ ^ ]专注于您想要关注的 TextBox

  1. Decide the criteria when exactly you want to have the focus on the second TextBox.
    For Example - when MaxLength reaches, the focus will go to second TextBox.
  2. Use the javaScript onkeypress Event[^] for the first TextBox and call one function.
  3. On that function, check if the criteria/condition is satisfied or not and just use HTML DOM focus() Method[^] to focus on the TextBox you want to give focus on.

这篇关于如何在jsp中使用keypress事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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