Method 1:
var temp = /[A -Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}: [A-Fa-f0-9]{2}:[A-Fa-f0-9]{2}/;
if (!temp.test(document.mac.value))
{
Return false;
}
Method 2:
function macFormCheck(mac)
{
var macs = new Array();
macs = mac.split(":");
if(macs.length != 6){
alert("The entered mac address format is incorrect, please enter it in the form of xx:xx:xx:xx:xx:xx (xx is a hexadecimal number)! ");// Yiwang online tutorial http://yige.org/js/
return false;
}
for (var s=0; s<6; s ) {
var temp = parseInt(macs[s],16);
if(isNaN(temp))
{
alert("The entered mac address format is incorrect, please Enter in the form of xx:xx:xx:xx:xx:xx (xx is a hexadecimal number)!");
return false;
}
if(temp < 0 | );
return false;
}
}
return true;
}
Statement: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