<script type="text/javascript">
window.document.onkeydown = function()
{
if((document.activeElement.type!='button')
&& (document.activeElement.type!='submit')
&& (event.keyCode==13))
{
if(document.activeElement.type=='textarea')
{
}
}
else
{
event.returnValue = false;
}
}
}
</script>
Reference : http://blog.csdn.net/wang8712/archive/2008/04/18/2303340.aspx