Depending on what you are trying to do, there is an interesting way to do this, which works (some work is required).
First, the search starts from the place where the last click of the user. So, to get to the right context, you can force click on the div. This will put the internal pointer at the beginning of the div.
Then you can use window.find, as usual, to find the item. It will highlight and move to the next item found. You can create your own dialog and handle the truth or false returned by find, and also check the position. For example, you can save the current scroll position, and if the next returned result is outside the div, you will restore the scroll. Also, if it returns false, you can say that no results were found.
You can also show the default search box. In this case, you can specify the starting position, but not the ending position, because you lose control.
Sample code to get you started. I could also try expanding jsfiddle if there is enough interest.
Syntax:
window.find(aStringToFind, bCaseSensitive, bBackwards, bWrapAround, bWholeWord, bSearchInFrames, bShowDialog);
For example, to start a search inside myDiv, try
document.getElementById("myDiv").click(); //Place cursor at the beginning window.find("t", 0, 0, 0, 0, 0, 0); //Go to the next location, no wrap around
You can set the blur event handler (lose focus) so that you know when you leave the div to stop the search.
To save the current scroll position, use document.body.scrollTop. Then you can set it back if it tries to go beyond the div.
Hope this helps! ~ Techdude