// /app/webroot/js/tabulator.js function insertTab(event, obj) { var tabKeyCode = 9; if (event.which) // mozilla var keycode = event.which; else // ie var keycode = event.keyCode; if (keycode == tabKeyCode) { if (event.type == "keydown") { var oldscroll = obj.scrollTop; if (obj.setSelectionRange) { // mozilla var s = obj.selectionStart; var e = obj.selectionEnd; obj.value = obj.value.substring(0, s) + "\t" + obj.value.substr(e); obj.setSelectionRange(s + 1, s + 1); obj.focus(); } else if (obj.createTextRange) { // ie document.selection.createRange().text = "\t" obj.onblur = function() { this.focus(); this.onblur = null; }; } obj.scrollTop = oldscroll; } if (event.returnValue) // ie ? event.returnValue = false; if (event.preventDefault) // dom event.preventDefault(); return false; // should work in all browsers } return true; }