faqts : Computers : Programming : Languages : JavaScript : Forms : TextAreas/TextFields

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 24 people (38%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can I move the cursor to a specific location in a textarea?
what are startol and endOl

May 26th, 2005 00:42
tomas santoro, Vipin Gupta,


function setCursorPosition(oInput,oStart,oEnd) {
   	       if( oInput.setSelectionRange ) {
    	         oInput.setSelectionRange(oStart,oEnd);
             } 
             else if( oInput.createTextRange ) {
                var range = oInput.createTextRange();
                range.collapse(true);
                range.moveEnd('character',oEnd);
                range.moveStart('character',oStart);
                range.select();
             }
       }