Use JavaScript to implement an IP address input box, feeling is not too good, if it is 192.168.1.1 must input 192.168.001.001 the awkward AH
<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <meta name=" generator "content=" Microsoft FrontPage 4.0 "> <meta name=" ProgId "content = "FrontPage.Editor.Document" > <style> a3{width:30;border:0;text-align:center} </style> <script > Function Mask (obj) {obj.value=obj.value.replace (/[^\d]/g, ') key1=event.keycode if (key1==37 | | key1==39) {Obj.blur (); Nextip=parseint (Obj.name.substr (2,1)) nextip=key1==37?nextip-1:nextip+1; Nextip=nextip>=5?1:nextip nextip=nextip<=0?4:nextip eval ("IP" +nextip+ ". Focus ()")} if (obj.value.length>=3 ) if (parseint (obj.value) >=256 | | parseint (Obj.value) <=0) {alert (parseint (obj.value) + "IP address error!) ") obj.value=" "Obj.focus () return false; else {Obj.blur (); Nextip=parseint (Obj.name.substr (2,1)) +1 nextip=nextip>=5?1:nextip nextip=nextip<=0?4:nextip eval ("IP" + Nextip+ '. focus ()}} function Mask_c (obj) { Clipboarddata.setdata (' Text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ')} </script> <title> IP address input </title> </pead> <body>ip address input <div > <input type=text name=ip1 maxlength=3 clas S=a3 onkeyup= "Mask (This)" Onbeforepaste=mask_c (). <input type=text name=ip2 maxlength=3 class=a3 onkeyup= "Mask (This)" Onbeforepaste=mask_c (). <input type=text name=ip3 maxlength=3 class=a3 onkeyup= "Mask (This)" Onbeforepaste=mask_c (). <input type=text name=ip4 maxlength=3 class=a3 onkeyup= "Mask (This)" Onbeforepaste=mask_c () > </div> ;/body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Everyone has time to get down, add an input. You can switch to the next