一个关于输入CD-KEY自动分割的脚本
1 <html>
2 <head>
3 <meta http-equiv="content-Type" content="text/html;charset=utf-8">
4 <title>输入CD-KEY自动分割</title>
5 <script language="JavaScript" type="text/javascript">
6
7 function cdkeyInput(thisobj)
8 {
9 objResult = "";
10 nextObjResult = "";
11
12 if(thisobj.value.indexOf('-') > 0)
13 {
14 objResult = thisobj.value.substring(0,thisobj.value.indexOf('-'));
15 nextObjResult = thisobj.value.substring(thisobj.value.indexOf('-')+1);
16
17 thisobj.value = objResult.substring(0,thisobj.attributes["max"].nodeValue);
18 if(arguments[1] != undefined && arguments[1] != null)
19 {
20 next = arguments[1];
21 nextobj = document.getElementById(next);
22 nextobj.value = nextObjResult.toUpperCase();
23 nextobj.onkeyup();
24 }
25 }
26 thisobj.value = thisobj.value.toUpperCase();
27 }
28
29 </script>
30 </head>
31 <body>
32 </br>
33 <input type="text" name="key1" id="key1" max="8" size="8" onkeyup="cdkeyInput(this,'key2');"/>-
34 <input type="text" name="key2" id="key2" max="4" size="4" onkeyup="cdkeyInput(this,'key3');"/>-
35 <input type="text" name="key3" id="key3" max="4" size="4" onkeyup="cdkeyInput(this,'key4');"/>-
36 <input type="text" name="key4" id="key4" max="4" size="4" onkeyup="cdkeyInput(this,'key5');"/>-
37 <input type="text" name="key5" id="key5" max="4" size="4" onkeyup="cdkeyInput(this,'key6');"/>-
38 <input type="text" name="key6" id="key6" max="8" size="8" onkeyup="cdkeyInput(this);"/>
39
40 </body>
41 </html>
2 <head>
3 <meta http-equiv="content-Type" content="text/html;charset=utf-8">
4 <title>输入CD-KEY自动分割</title>
5 <script language="JavaScript" type="text/javascript">
6
7 function cdkeyInput(thisobj)
8 {
9 objResult = "";
10 nextObjResult = "";
11
12 if(thisobj.value.indexOf('-') > 0)
13 {
14 objResult = thisobj.value.substring(0,thisobj.value.indexOf('-'));
15 nextObjResult = thisobj.value.substring(thisobj.value.indexOf('-')+1);
16
17 thisobj.value = objResult.substring(0,thisobj.attributes["max"].nodeValue);
18 if(arguments[1] != undefined && arguments[1] != null)
19 {
20 next = arguments[1];
21 nextobj = document.getElementById(next);
22 nextobj.value = nextObjResult.toUpperCase();
23 nextobj.onkeyup();
24 }
25 }
26 thisobj.value = thisobj.value.toUpperCase();
27 }
28
29 </script>
30 </head>
31 <body>
32 </br>
33 <input type="text" name="key1" id="key1" max="8" size="8" onkeyup="cdkeyInput(this,'key2');"/>-
34 <input type="text" name="key2" id="key2" max="4" size="4" onkeyup="cdkeyInput(this,'key3');"/>-
35 <input type="text" name="key3" id="key3" max="4" size="4" onkeyup="cdkeyInput(this,'key4');"/>-
36 <input type="text" name="key4" id="key4" max="4" size="4" onkeyup="cdkeyInput(this,'key5');"/>-
37 <input type="text" name="key5" id="key5" max="4" size="4" onkeyup="cdkeyInput(this,'key6');"/>-
38 <input type="text" name="key6" id="key6" max="8" size="8" onkeyup="cdkeyInput(this);"/>
39
40 </body>
41 </html>