Javascript Function to disable Enter Key

function disableEnterKey(e) {
var key;

if (window.event)
key = window.event.keyCode;     //IE
else
key = e.which;     //firefox

if (key == 32)
return false;
else
return true;
}