2021-06-03 10:52:41 +08:00

50 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function jiemi(arr){
var newarr=[]
if(arr.length==4){
for(let i=0;i<arr.length;i++){
arr[i]=parseInt(arr[i])
arr[i]=(arr[i]+5)%10
}
console.log(arr)
newarr[0]=arr[3]
newarr[1]=arr[2]
newarr[3]=arr[0]
newarr[2]=arr[1]
}
console.log(newarr,"new")
}
function check(str){
var arr=str.split('.')
var res;
if(arr.length==4){
for(let i=0;i<arr.length;i++){
if(Number(arr[i])>0 && Number(arr[i])<255){
res=true
}else{
res=false
}
}
if(res){
console.log("是ipv4")
}else{
console.log("不是ipv4")
}
}else{
console.log("不合规")
}
}
</script>
</body>
</html>