</Script>
There is no bit operation in vbs, so js and vbs are used in a page, which is not good. If you use vbs, you can do it, but it is a bit too long, and pay attention to it, if you split ("202.102.29.6", ",") in vbs, you will get three numbers: 202,102 and 29, but not the last six, therefore, you need to change the ip address to split ("202.102.29.6 "&". ",",")
I am using vbs, because there is no bit operation, so it is quite troublesome.
<%
Function ip2int (ipstr)
Dim iptemp, max
Iptemp = split (ipstr &".",".")
Max = ubound (iptemp)
If max <> 4 then
Exit function
End if
Dim a, B, I
A = "& H"
For I = 0 to 3
B = Hex (iptemp (I ))
If len (B) = 1 then
B = "0" & B
End if
A = a & B
Next
Ip2int = CLng ()
End function
Function int2ip (ip)
Dim iptemp, a, ipstr, I, length
Iptemp = Hex (ip)
Length = 8-len (iptemp)
For I = 1 to length
Iptemp = "0" & iptemp
Next
A = left (iptemp, 2)
A = "& H" &
I = CInt ()
A = CStr (I)
Ipstr = &"."
A = mid (iptemp, 3, 2)
A = "& H" &
I = CInt ()
A = CStr (I)
Ipstr = ipstr & &"."
A = mid (iptemp, 5, 2)
A = "& H" &
I = CInt ()
A = CStr (I)
Ipstr = ipstr & &"."
A = right (iptemp, 2)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.