Validation not working properly

Friends i am trying to make a validation on form and validation work perfectly on Google Chrome but not working on Fire Fox. Please check the code and tell me what’s the problem in it.

<script> 
function check_empty() {
var str=true;
var user_name = /^[A-z]+$/;
var email_val = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
var phnor =/^[2-9]\d{2}-\d{3}-\d{4}$/;
var pwd = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,}/;
if (!document.form.uname.value.match(user_name))
				{
				document.getElementById('msg1').innerHTML="*Please enter a username*";
				 
				str=false;
				}
				else if (document.form.uname.value != "")
				 {
				document.getElementById('msg1').innerHTML="";
				
				str=false;
				 }
				 
				 
if (!document.form.email.value.match(email_val))
				{
				document.getElementById("msg3").innerHTML="Please Enter Valid Email ID";
				str=false;
				}
				else if (document.form.email.value != "")
				 {
				document.getElementById("msg3").innerHTML="";
				str=false;
				 }
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.