I am using this code in a HTML page but every time the result is erroneous.


function check()
{var a=document.getElementById("txt_user").value.trim;
var b=document.getElementById("txt_pwd").value.trim;
if((a=="")||(b==""))
{alert("Required fields can't be left empty");
return false;
}
else if(a==b)
{alert("Username and password are same");
return false;
}
}
Whatever be the values in textboxes txt_user and txt_pwd the alert comes as "Username and password are same".
Please let me know if there is any bug in the code.
Thanks in advance.