function validateMac() {
var mac = "a1:b2:c3:d4:d5:e6";
mac = mac.toUpperCase();
var expre = /[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}/;
var regexp = new RegExp(expre);
if (!regexp.test(mac)) {
alert("MAC地址错误或含有非法字符,请检查");
return;
}
}
【JavaScript】JS校验MAC地址
最新推荐文章于 2024-07-04 08:49:05 发布