当前位置: 移动技术网 > IT编程>开发语言>JavaScript > JavaScript实现自动跳转文本功能

JavaScript实现自动跳转文本功能

2018年04月29日  | 移动技术网IT编程  | 我要评论

贴一段自动跳转文本的代码实现:

实现代码:

<html>
  <head>
    <title>文本跳转</title>
    <style type=text/css>
      body{
        margin-top: 10px;
        font-size: 10pt;
        margin-left: 10px;
        margin-right: 0px;
        font-family: "微软雅黑"
      }
    </style>
    <meta http-equiv=content-type content="text/html; charset=gb2312">
  </head>

  <body>
    <script type="text/javascript">
      function inbox1() {
        if(document.code.box1.value.length == 4) {
          document.code.box2.focus();
        }
      }

      function inbox2() {
        if(document.code.box2.value.length == 4) {
          document.code.box3.focus();
        }
      }

      function inbox3() {
        if(document.code.box3.value.length == 4) {
          document.code.box4.focus();
        }
      }
    </script>
    <formname="code" action="" method="post">输入:
      <input maxlength="4" size="4" name="box1" onkeyup="return inbox1()">-
      <input maxlength="4" size="4" name="box2" onkeyup="return inbox2()">-
      <input maxlength="4" size="4" name="box3" onkeyup="return inbox3()">-
      <input maxlength="4" size="4" name="box4">
    </form>
  </body>
</html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网