document.onkeypress = function (event) { if ( (event = event || window.event).keyCode == 8 || event.keyCode == 9 ) { event.preventDefault ? event.preventDefault() : (event.returnValue = false); } }