var name = document.contact_frm.conn_name
var email = document.contact_frm.conn_email
var phone = document.contact_frm.conn_phone
var mobile = document.contact_frm.conn_mobile
var topic = document.contact_frm.conn_topic
if (name.value.length == 0) {
alert('Please input you name.')
name.focus()
return false
} else if (email.value == "") {
alert('Please input email for contact.')
email.focus()
return false
<script>
function check_data()
{
var format_num = /^([0-9])+$/;
var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
if (!(format_num.test(document.getElementById('num').value)))
{
alert("กรอกได้เฉพาะตัวเลข");
document.getElementById('num').focus();
return false;
}
if (!(format_mail.test(document.getElementById('email').value)))
{
alert("รูปแบบอีเมลไม่ถูก");
document.getElementById('email').focus();
return false;
}
}
</script>