try like this..
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var dosomethig = function () {
if (true) { // your condition here
alert('do something');
return true;
}
else {
alert('do something');
return false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ImageButton ID="ImageButton1" runat="server" Height="28px" Width="100px" OnClientClick=" return dosomethig();"
ImageUrl="~/background.gif" OnClick="ImageButton1_Click" />
</form>
</body>
</html>