Hi...
you can try this code
<script language="javascript" type="text/javascript">
function validatelogin() {
if (document.getElementById("<%=txtusername.ClientID%>").value == "") {
alert("UserName Feild can not be blank");
document.getElementById("<%=txtusername.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtpassword.ClientID%>").value == "") {
alert("Password Feild can not be blank");
document.getElementById("<%=txtpassword.ClientID%>").focus();
return false;
}
}
in button click
<asp:ImageButton ID="imglogin" runat="server" ImageUrl="~/Images/login1.png" OnClick="imglogin_Click"
OnClientClick="return validatelogin()" /></div>