方法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}:[A-FA-FA-F0-9]
if(!temp.test(document.mac.value)))
{
falseを返します。
}
方法2:
コードコピーは次のとおりです。
機能MacFormCheck(MAC)
{
var macs = new array();
macs = mac.split( ":");
if(macs.length!= 6){
Alert( "入力MACアドレス形式が正しくありません。XX:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx(hexadecimal number)の形式で入力してください。
falseを返します。
}
for(var s = 0; s <6; s ++){
var temp = parseint(macs [s]、16);
if(isnan(temp))
{
Alert( "入力MACアドレス形式が正しくありません。XX:xx:xx:xx:xx:xx:xx:xx(xxは16進数)の形式で入力してください。");
falseを返します。
}
if(temp <0 || temp> 255){
Alert( "入力MACアドレス形式が正しくありません。XX:xx:xx:xx:xx:xx:xx:xx(xxは16進数)の形式で入力してください。");
falseを返します。
}
}
trueを返します。
}