function checkit(fm){ if (!fm.seltype.value){ alert('Please select the type of inquiry!'); fm.seltype.focus(); return; } if (!fm.username.value){ alert('Please type a name!'); fm.username.focus(); return; } if (!fm.cel02.value){ alert('Please enter your contact information!'); fm.cel02.focus(); return; } if (!fm.cel03.value){ alert('Please enter your contact information!'); fm.cel02.focus(); return; } if (!fm.email01.value){ alert('Please enter your email!'); fm.email01.focus(); return; } if (!fm.email02.value){ alert('Please enter your email!'); fm.email02.focus(); return; } if ((fm.email01.value) && (fm.email02.value)){ var semail = fm.email01.value + "@" + fm.email02.value; $("#email").val(semail); } if (fm.email.value){ var email = fm.email.value; if (!formEmailCheck(email)) { fm.email.focus(); return; } } if (!fm.subject.value){ alert('Please type a title!'); fm.subject.focus(); return; } if (!fm.comment.value){ alert('Please type the content!'); fm.comment.focus(); return; } fm.action="/en/customer/faq.php"; fm.submit(); } function formEmailCheck(email) { var emailexp =/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i; if(!emailexp.test(email)) { alert("Not valid email form."); return; } return true; } $(document).ready(function(){ $(".onlynum").keyup( function(){ $(this).val( $(this).val().replace(/[^0-9]/gi,"") ); }); });