function SetDefalutButton(e, buttonid)
{
var evt = e ? e : window.event;
if (evt.keyCode == 13)
{
var bt = $('[id$='+buttonid+']');
if (bt.length > 0)
{
if (evt.keyCode == 13)
{
eval( bt[0].href);
return false;
}
}
}
}
Here is how we use it:
<asp:TextBox ID="txtBox" runat="server"
onkeypress="return SetDefalutButton(event,'btnTest');" MaxLength="50"></asp:TextBox>