//check the format of IP address //Write by Ken function checkIP(ip) ...{ var re =/^((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5])))).((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5])))).((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5])))).((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5]))))$/; if(re.test(ip)) returntrue; else returnfalse; } //check the format of email //Write by Ken //Note: //Begining by number or leter. function checkEmail(email) ...{ var re =/^((d|[a-z]|[A-Z])(((d|[a-z]|[A-Z]|_)...{1,19})))@((((d|[a-z]|[A-Z])...{1,10}).)...{1,4})(((d|[a-z]|[A-Z]))...{2,10})$/; //var re = /^((d|[a-z]|[A-Z])|(((d|[a-z]|[A-Z]){1,19})))@((((d|[a-z]|[A-Z]).){1, 4})(((d|[a-z]|[A-Z])){2, 10}))$/; if(re.test(email)) returntrue; else returnfalse; } function onIPClick() ...{ if(checkIP(form1.ip.value)) alert('true'); else alert('false'); } function onEmailClick() ...{ if(checkEmail(form1.email.value)) alert('true'); else alert('false'); }
function.js //check the format of IP address//Write by Kenfunction checkIP(ip)...{ var re = /^((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5])))).((d)|(([1-9])d)|(1dd)|(2(([0-4]d)|5([0-5])))).((d)|(([