驗證規則:
1.廣播 mac 位址 (FF:FF:FF:FF::FF:FF:)
2. IPv4 和 IPv6 多播 MAC 位址
3.數字字元
代碼列表:
function isValidMacAddress(address) { cp '';
var i = 0, j = 0;
if ((address.toLowerCase() == 'ff:ff:ff:ff:ff:ff') || (address. toLowerCase() == '00:00:00:00:00 :00')) {
alert('錯誤');
var addrParts = address.split(':');
if (addrParts.length != 6) {
alert('錯誤'); for (i = 0 ; i if (addrParts[i] == ''){
alse;
}
}
if (addrParts[i].length != 2) {
alert('錯誤');
addrParts[i ].length; j ) {
c = addrParts[i].toLowerCase().charAt(j);
>= 'a' && c 續;
🎜> 返回false;
}
}
if ((parseInt(addrParts[0], 16) % 2) == 1) {
alert('錯誤'); 🎜>
回傳true;
}