Try this
function bindTabbing(event)
{
if (event.which || event.keyCode)
{
if ((event.which == 9) || (event.keyCode == 9))
{
var subject = document.getElementById(txtProgramEditor);
if (event.srcElement == subject)
{
subject.selection = document.selection.createRange();
subject.selection.text = String.fromCharCode(9);
event.returnValue = false;
}
if (subject.selectionStart || subject.selectionStart == '0')
{
var str = subject.value;
var startIndex = subject.selectionStart;
subject.value = str.substring(0, startIndex) + ' ' + str.substring(startIndex, str.length);
subject.focus();
subject.selectionEnd = startIndex + 4;
return false;
}
}
}
else
{
return true;
}
}