<! DOCTYPE HTML Public "-//ietf//dtd html//en" > <ptml><pead> <title> Test </title> <meta http-e quiv= "Content-type" content= "text/html; charset=gb2312 "> <meta http-equiv=" pragma "content=" No-cache "> <style type=" text/css "><!--. Textiploghidden {border-right:2px; border-top:2px; font-size:12px; border-left:2px; width:30px; COLOR: #ffffff; border-bottom:2px; Font-family:sans-serif; height:22px; Border:1 Solid #000000} textipinput {border-right:0px; border-top:0px; font-size:11px; border-left:0px; width:30px; COLOR: #000000; border-bottom:0px; Font-family:sans-serif; height:19px; Background-color: #ffffff; Text-align:center}--></style> <script language=javascript1.2> function checkipvalid_1 () {if ( Event.shiftkey) {event.returnvalue=false; Return var keycode = parseint (Event.keycode); var result=true; if ((keycode==8) | | (keycode==37) || (keycode==39) | | (keycode==9)) Return if ((keycode>=48) && (keycode<=57)) return; else Result=false; if ((keycode>=96) && (keycode<=105)) return; else Result=false; if ((keycode==110) | | (keycode==190) | | (keycode==32)) {event.keycode=9; Return } if (Result==false) Event.returnvalue=false; function Checkipvalid_2 (formname,ip) {var form = eval ("document.") +formname) var ip_1 = parseint (eval ("form.") +ip+ ". Value")); if (ip_1>223) {eval ("form.") +IP). value= "223"; Alert (ip_1+ "is not a valid item, specify a value between 1 and 223"); else if (ip_1==127) {eval ("form.") +IP). value= "1"; Alert ("The IP address beginning with 127 is invalid because they are reserved for loopback addresses, specify some other valid value between 1 and 223"); } function Checkipvalid_3 (mask) {if typeof (mask)!= ' object ') {mask = eval (mask)} VA R Maskint=parseint (Mask.value); if ((maskint<0) | | (maskint>255)) { mask.value=255; Alert (maskint+ "is not a valid item, specify a value between 0 and 255"); } function Checkipvalid_4 (mask) {var maskint=parseint (mask.value); if ((maskint<0) | | (MASKINT>32)) {mask.value= ""; Alert ("Mask error, please specify a value between 0 and 32"); } function Checkipvalid_5 () {var keycode = parseint (Event.keycode); var result=true; if ((keycode==219) | | (keycode==221) | | (keycode==191) | | (keycode==220) | | (keycode==186) | | (keycode==32)) {result=false; } if (Result==false) Event.returnvalue=false; } </SCRIPT> </pead> <body> <form name=form1> <table width= "100%" border= "0" cellpadding= "4" cellspacing= "2" > <tr> <td colspan= "2" align= "right" ><table border= "0" cel lpadding= "0" cellspacing= "0" > <tr> <td width= "align=" "Right" >ip Address: & lt;/td> <td width= "Alig"N= "left" valign= "bottom" ><table border= "0" cellpadding= "0" cellspacing= "0" class= "Textiploghidden" > <tr> <td width= "align=" "Center" valign= "bottom" ><input name= "Ip1" M Axlength= "3" class= "Textipinput" value= "onkeydown=" Checkipvalid_1 () "onkeyup=" Checkipvalid_2 (' Form1 ', ' ip1 ') " ></td> <td align= "center" width= "4" >.</td> <TD Width= "align=" "Center" valign= "bottom" ><input name= "Ip2" maxlength= "3" class= "Textipinput" value= "" Onkeydown= "Checkipvalid_1 ()" onkeyup= "Checkipvalid_3 (eval (' document.form1.ip2 '))"/></td> <TD align= "Center" width= "4" >.</td> <td width= "align=" center "valign=" bottom "><input name=" IP3 "maxlength=" 3 "class=" Textipinput "value=" "onkeydown=" Checkipvalid_1 () "onKeyUp=" Checkipvalid_3 (eval (' DOCUMENT.FORM1.IP3 ')) "/></td> <TD align= "Center" width= "4" >.</td> <td width= "align=" C Enter "valign=" bottom "><input name=" IP4 "maxlength=" 3 "class=" Textipinput "value=" "onkeydown=" Checkipvalid_1 ( ) "onkeyup=" Checkipvalid_3 (eval (' DOCUMENT.FORM1.IP4 ')) "/></td> </tr> </table></td> </tr> </table></td> </TR&G T </table> </form> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]