Idea: Convert two IP to a number to compare, the small one slowly add one, until become the big that IP converted number, this one of the number is converted to IP address that is the IP segment all the IP.
1 //IP to Digital2 functionip2int (IP)3 {4 varnum = 0;5ip = Ip.split ("."));6num = number (ip[0]) * * * * * * * * * * * * * * + number (ip[1]) * * * * * * + number (ip[2]) * + + number (ip[3]);7num = num >>> 0;8 returnnum;9 }Ten One //Digital to IP A functionint2ip (num) - { - varstr; the vartt =NewArray (); -TT[0] = (num >>>) >>> 0; -TT[1] = ((num << 8) >>>) >>> 0; -TT[2] = (num << +) >>> 24; +TT[3] = (num <<) >>> 24; -str = string (tt[0]) + "." + string (tt[1]) + "." + string (tt[2]) + "." + String (tt[3]); + returnstr; A } at - //list IP in IP segment - functionListip (ip1,ip2) { - varIpInt1 =Ip2int (ip1); - varIpInt2 =Ip2int (IP2); - for(vari = Ipint1;i <= ipint2;i++){ indocument.write (Int2ip (i) + ' <br/> '); to } + } - theListip (' 158.66.23.0 ', ' 158.66.23.255 ');
JavaScript traverses all IP in the IP segment
JavaScript traverses all IP in the IP segment