scrolling in textarea to selection in FF



Hi all,
I wrote a simple search function to find text in a textarea where not
all the text is visible (ie. the text box displays 10 lines but there
may be more than 1000 lines to search). I can find the text and select
it using the function below, BUT I can't figure out how to have the
textarea automatically scroll to the selection in Firefox. Any ideas or
suggestions?

function search(needle,haystack,start) {
var element = document.getElementById(haystack);
index = element.value.indexOf(needle,start);
element.setSelectionRange(index, index+needle.length);
}

Thanks for any insight,
Keith

.



Relevant Pages

  • Re: window.opener.forms not working in Firefox.
    ... I read Martin Honnen's bit about textarea and think he's right. ... -up pops a popup with a SAFileUp form ... -the ASP script stores the image, returns a script on the popup to update a form in the parent window with: ... This works well on IE but not Firefox. ...
    (comp.lang.javascript)
  • Re: Standard newline character
    ... Internet message headers have an ... I just tested how Firefox behaves, and it correctly sends CR LF (encoded ... as %0D%0A) when a newline is entered in a textarea. ...
    (comp.infosystems.www.authoring.html)
  • Re: Getting Google off FireFox
    ... That is not google toolbar, that is the built in search function of ... firefox (notice if you click on the very left of the search bar you ...
    (misc.news.internet.discuss)
  • Re: "white-space: pre;" and IE
    ... (And you should not use a name like "textarea" - it is just confusing, since HTML has the element.) ... This applies to all HTML elements without exception." ... My Firefox 2 correctly ignores those line breaks, so what does your document really contain and which version of Firefox 2 are you using. ... IE ignores white-space: ...
    (alt.html)
  • Re: TEXTAREA bug in Mozilla?
    ... me the text that's currently in the textarea. ... .innerText in Mozilla by using .textContent are wrong, ... Since input elements can't have any content, both IE and FireFox show ...
    (comp.lang.javascript)