Code:
<script language="javascript">
function validation()
{
var email=document.form.email.value
var filter=/^.+@.+\..{2,7}$/
var valid = true;
if(document.form.email.value==')
{
setTimeout('window.alert('Please enter your email address!')',1250);
document.form.email.focus();
document.form.email.select();
valid = false;
}
else if(!(document.form.email.value=='))
{
if(!filter.test(document.form.email.value))
{
setTimeout('alert('Please input a valid email address!')',1250);
document.form.email.focus();
document.form.email.select();
valid= false;
}
}
}
</script>
This is the code I am trying to run from my .jsp file. This function is being called onClick() of the "Send" button. But the problem is this function is never called and the cursor does not stop at the email field after the alert. It just continues and I am not able to see the alert message. Somebody please give some suggestion. I have tried many things but no luck,
Thanks
gayatri