在某些情况下光标移动 [英] cursor movement on some condition

查看:70
本文介绍了在某些情况下光标移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在填写一定的编号后如何将光标移动到下一个字段.

how to move my cursor to next field after filling a certain no. in a text box automatically?

推荐答案

使用Javascript:
Use Javascript:
function moveToNext(field,nextFieldID)
{
  if(field.value.length >= field.maxLength)
  {
    document.getElementById(nextFieldID).focus();
  }
}





<input type="text" id="First" maxlength=10 onkeyup="moveOnMax(this,'Second')"/>
<input type="text" id="Second" maxlength=10 onkeyup="moveOnMax(this,'First')"/>


这篇关于在某些情况下光标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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