JavaScript實現(xiàn)自動跳轉文本功能
更新時間:2017年05月25日 15:59:20 作者:且聽風吟leo
這篇文章主要為大家詳細介紹了JavaScript自動跳轉文本功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下
貼一段自動跳轉文本的代碼實現(xiàn):
實現(xiàn)代碼:
<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>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
javaScript實現(xiàn)網(wǎng)頁版的彈球游戲
這篇文章主要為大家詳細介紹了javaScript實現(xiàn)網(wǎng)頁版的彈球游戲,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-07-07