View Single Post
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Add textbox to editable div problem

 
0
  #2
Apr 8th, 2005
You need to empty the current selection range.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function addtb()
  2. {
  3. document.selection.empty();
  4. document.getElementById("TextEditor").focus();
  5. cmd = 'InsertInputText';
  6. document.getElementById('TextEditor').document.execCommand(cmd,'true');
  7.  
  8. var TE = document.getElementById('TextEditor');
  9. var TEcn=TE.children;
  10.  
  11. for (i=0;i<TEcn.length;i++)
  12. {
  13. n++;
  14. if(TEcn[i].id == "")
  15. TEcn[i].id = "tb" + n;
  16. }
  17.  
  18. }
Reply With Quote