Home > Web Front-end > JS Tutorial > body text

js sends a function to determine whether a string meets the standard_javascript skills

WBOY
Release: 2016-05-16 18:53:41
Original
1293 people have browsed it
复制代码 代码如下:

function ZQH_isIP(str){
var arrIP = str.split(".");
if(arrIP.length != 4){
return false;
} else {
var i;
for(i in arrIP)
{
if(ZQH_isNumeric(arrIP[i]))
{
if(arrIP[i] < 0 || arrIP[i] > 255){
return false;
}
} else {
return false;
}
}
}
return true;
}

function ZQH_isNumeric(str){
if(str.length == 0){
return false
}
for(var i=0; iif(str.charAt(i) < "0" || str.charAt(i) > "9"){
return false;
}
}
return true;
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template