HTML中輸入框自動切換到下一個,輸入框自動切換

來源:互聯網
上載者:User

HTML中輸入框自動切換到下一個,輸入框自動切換

最近看了部關於喬布斯的電影,感覺裡面的電影情節還是很棒的。

就是軟體開發人員一定要考慮到使用者的感受,一定要能非常簡單的使用起來。

最近感覺公司的一些平台還是存在很多不好使用的地方。比如輸入IP的輸入框。

現在的設計是需要使用者輸入焦點號。

我想能不能設計成類似於windows的那種輸入的方式。

設計為四個輸入框,其中點號已經添加進去了。

其中那一段指令碼必須要放入body內,否則無法識別到這個函數

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href="<%=basePath%>"><title>IP添加方式改變</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--></head><body><form id="myForm"><table align="center" border="1px" cellpadding="0" cellspacing="0"><tr><td align="center">IP添加方式</td></tr><tr><td><input tabindex="1" type="text" size="3" maxlength="3"  onkeyup="checkLen(this,this.value)" onkeypress="return checkNum(event)" />.<input tabindex="2" type="text" size="3" maxlength="3"onkeyup="checkLen(this,this.value)" onkeypress="return checkNum(event)" />.<input tabindex="3" type="text" size="3" maxlength="3"onkeyup="checkLen(this,this.value)" onkeypress="return checkNum(event)"/>.<input tabindex="4" type="text" size="3" maxlength="3"onkeyup="checkLen(this,this.value)" onkeypress="return checkNum(event)"/></td></tr></table></form></body><script type="text/javascript">        function checkLen(x, y) {   if (y.length == x.maxLength) {var next = x.tabIndex;//是否到了最後一個文字框if (next < document.getElementById("myForm").length) {document.getElementById("myForm").elements[next].focus();}}}
function checkNum(e){var keynumvar keycharvar numcheckif(window.event) // IE{keynum = e.keyCode}else if(e.which) // Netscape/Firefox/Opera{keynum = e.which}keychar = String.fromCharCode(keynum)numcheck = /\d/;return numcheck.test(keychar)}</script></html>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.