This works for me:
<script type="text/javascript">
function setValue()
{
document.getElementById("TextBox1").value = "abcd";
return true;
}
</script>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return setValue();" onclick="Button1_Click" />