setSelection

How do you use the selection.setSelection(a,b) function to highlight areas of text, cos i saw this in a book but it doesnt seem to work.