function isEmail(s) { var re; re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; if (re.test(s) == true) return true; else return false; } function validate() { var name=document.getElementById('Name').value; var company=document.getElementById('Company').value; var email=document.getElementById('email').value; var phone=document.getElementById('Phone').value; var sc=document.getElementById('security_code').value; if(name=="") { alert("Please enter Name."); document.getElementById('name').focus(); document.getElementById('name').select(); return false; } if(company=="") { alert("Please enter Company."); document.getElementById('company').focus(); document.getElementById('company').select(); return false; } if(phone=="") { alert("Please enter Phone."); document.getElementById('phone').focus(); document.getElementById('phone').select(); return false; } if(email=="") { alert("Please enter Email."); document.getElementById('email').focus(); document.getElementById('email').select(); return false; } if(!isEmail(document.getElementById('email').value)) { alert("Please enter valid Email."); document.getElementById('email').focus(); document.getElementById('email').select(); return false; } if(sc=="") { alert("Please enter Security Code."); document.getElementById('security_code').focus(); document.getElementById('security_code').select(); return false; } }