Using the scrollintoview html property in a jsp

D

da_rod_father

Hi all,

i have a jsp that dynamically displays rows of data, on a row u can
click a link to navigate off to another page that corresponds to the
link and perform some function. once u finish performing that function.
u navigate back to the previous page.

my issue is that my table that has dynamically built rows of data in
it, might have up to 500+ rows, when i come back to the page it
refreshes back to the top of that particular table. lets say i was at
row 335, now i have to scroll down and find the row i was previously
on.

i recently heard about the "scrollintoview" property for ie. i would
like to know if anyone has any working examples that use this function?
or any insight that would point me in the right direction?
 
Joined
Nov 14, 2006
Messages
1
Reaction score
0
HTML scrollIntoView Method

I solved the problem in the following mode.

1. Define the javascript 'showCurrent' function:
function showCurrent()
{
var oCurrent = document.all.item("current");
if (oCurrent != null)
if (typeof(oCurrent.length) != "undefined")
for (i = 0; i < oCurrent.length; i++)
oCurrent(i).scrollIntoView(false);
else
oCurrent.scrollIntoView(false);
}

2. Assign the attribute id="current" to the object (for example to the table row <tr>) that must be visible when the page is loaded

3. Assign the attribute onload="showCurrent()" to the <body> tag

Note: this tip works also for several objects in the same page (for example for n tables in different <div style="overflow:auto> tags); in this case n objects (<tr> rows) must have the same id="current" attribute.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top