<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html;charset=gb2312" > <title> Input Cd-key Automatic segmentation </title> <script language= "JavaScript" type= "Text/javascript" > Function cdkeyinput (thisobj) {objresult = ""; Nextobjresult = ""; if (thisobj.value.indexOf ('-') > 0) {objresult = thisobj.value.substring (0,thisobj.value.indexof ('-')); Nextobjresult = thisobj.value.substring (thisobj.value.indexOf ('-') +1); Thisobj.value = objresult.substring (0,thisobj.attributes["Max"].nodevalue); if (arguments[1]!= undefined && arguments[1]!= null) {next = arguments[1]; Nextobj = document.getElementById (next); Nextobj.value = Nextobjresult.touppercase (); Nextobj.onkeyup (); } Thisobj.value = Thisobj.value.toUpperCase (); } </script> </pead> <body> <br> <input type= "text" name= "Key1" id= "Key1" max= "8" size= "8" Onkeyup= "Cdkeyinput (This, ' Key2 ');" />-<input type= "text" name= "Key2" id= "Key2" max= "4"Size= "4" onkeyup= "Cdkeyinput (This, ' Key3 ');" />-<input type= "text" name= "Key3" id= "Key3" max= "4" size= "4" onkeyup= "Cdkeyinput" (This, ' Key4 '); " />-<input type= "text" name= "Key4" id= "Key4" max= "4" size= "4" onkeyup= "Cdkeyinput" (This, ' key5 '); " />-<input type= "text" name= "Key5" id= "Key5" max= "4" size= "4" onkeyup= "Cdkeyinput" (This, ' Key6 '); " />-<input type= "text" name= "Key6" id= "Key6" max= "8" size= "8" onkeyup= "cdkeyinput (this);" /> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]