i'm giving you an example it will help you
<script type="text/javascript">
function validate()
{
if(document.getElementById("<%=txtName.ClientID %>").value == 0)
{
alert("Please Enter Name");
document.getElementById("<%=txtName.ClientID %>").focus();
return false;
}
</script>
<asp:button id="btnAdd" text="Add" runat="server" onclientclick="javascript:return validate();"/>