Web Analytics Made Easy -
StatCounter Findtext/ScrollintoView - CodingForum

Announcement

Collapse
No announcement yet.

Findtext/ScrollintoView

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Findtext/ScrollintoView

    Hi. On my web site I allow the user to find text in the main frame. That is, search for text and if found, scroll it into view. For IE, I use the following:

    if (IE) {
    txt = win.document.body.createTextRange();
    // Find the nth match from the top of the page.
    found = txt.findText(str)
    for (i = 0 ; i < n && found ; i++) {
    txt.moveStart("character", 1);
    txt.moveEnd("textedit");
    found = txt.findText(str)
    }
    // If found, mark it and scroll it into view.
    if (found) {
    txt.select();
    txt.scrollIntoView();
    n++ ; return true
    }
    }

    For Netscape 4 users, win.find() in a while loop works perfectly. But Netscape 6 doesn't have find(). Question. Is there a NS6 equalvalent to find()? Or there a DOMII equalvalent to findText/MoveStart?

    Any advice would be appreciated...Dennis
Working...
X