function setSel(){
  var f=document.f;
  var t=f.ta;
  if(t.setSelectionRange){
    var start=parseInt(f.start.value);
    var end  =parseInt(f.end  .value);
    t.setSelectionRange(start,end);
    t.focus();
  f.t.value = t.value.substr(t.selectionStart,t.selectionEnd-t.selectionStart);
  } else notSupported();
}
function setProp(id){
  var f=document.f;
  var t=f.ta;
  if(id==0) t.selectionStart = parseInt(f.start.value);
  if(id==1) t.selectionEnd   = parseInt(f.end  .value);
  f.t.value = t.value.substr(t.selectionStart,t.selectionEnd-t.selectionStart);
  t.focus();
}
function getProp(id){
  var f=document.f;
  var t=f.ta;
  if(id==0) f.start.value = t.selectionStart;
  if(id==1) f.end.value   = t.selectionEnd;
  if(id==2) f.txl.value = t.textLength;
  f.t.value = t.value.substr(t.selectionStart,t.selectionEnd-t.selectionStart);
  t.focus();
}
f:from
ta: textArea
用上面的方法解决,具体请看:Mozilla Dom Sample Project
http://cgi.din.or.jp/~hagi3/JavaScript/Mozilla/SampleList.cgi?fmt=sidebar