1. <script language = "javascript" >
  2. function checkEmail() {
  3. var email = document.getElementById('txtEmail');
  4. var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  5. if (!filter.test(email.value)) {
  6. alert('Please provide a valid email address');
  7. email.focus;
  8. return false;
  9. }
  10. }
  11. < /script>
Take a textbox and button in your aspx page and call the JavaScript function on button click.
  1. <input type='text' id='txtEmail'/>
  2. <input type='submit' name='submit' onclick='Javascript:checkEmail();'/>