Forum Moderators: open

Message Too Old, No Replies

Scroll to Word

Is this possible

         

HocusPocus

9:07 am on Oct 22, 2003 (gmt 0)

10+ Year Member



The following IE specific code highlights instances of the targetWord on a page.

targetWord= "word";
r=document.body.createTextRange();

for(i=0;r.findText(targetWord);i++){
r.execCommand('BackColor','','yellow');
r.collapse(false)
}

Has anyone any ideas, on how to make the window scroll to the first instance of the target word.

I think it can be possible but can't think of how to link in the method

window.scrollTo(x,y)

Thanks in advance for any ideas

-M

HocusPocus

12:17 pm on Oct 22, 2003 (gmt 0)

10+ Year Member



Just to save anyone,

r.select();

Finds and scrolls the window to the first occurance of targetWord.