You shouldn't do it. Overriding the behaviour the user expects is not good user experience. if you have to, try using event.preventDefault();
You could return false as additional measure. The code below supports IE < 9. This assumes all your conditions in if clause are correct, I just copied them.
var event = e || window.event;
if ((event.keyCode == 8 || (event.keyCode == 37 && event.altKey) || (event.keyCode == 39 && event.altKey))
&&
(event.srcElement.form == null || event.srcElement.isTextEdit == false)) {
event.stopPropagation ? event.stopPropagation() : (event.cancelBubble=true);
}
If this helps please take time to accept the solution. Thank you.