I have a HTML page with a block of text encased in <code> </code>. This text is unwrapped (because of the code block).
I want to write a javascript function that takes two arguments(starting line, and ending line).
On invoking this function, I want to scroll the page to
a) make the text within starting-line / ending-line visible (well, at-least the first line),
b) to highlight the enclosed text.
c) when I invoke this function with another pair of starting-line / ending-line, the block highilighted by the previous invocation may or may not be visible, but it should definitely not be hilighted.
Thus using buttons for next and previous, I should be able to navigate the page and get to all the code blocks I am interested in.
How do I go about this? I am sure this problem is not new and has been solved many times, but usually with "find". Here I know where I want to go, but don't know how to go there.
Navi