function Validate_Phone () { var frm = document.myForm; var re = /^\d{3}-\d{4}$/; if (!frm.txtPhone.value.match(re)) { alert("Not a valid phone number!"); frm.txtPhone.focus(); return false; } return true; }