aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to get scrollbar events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to get scrollbar events" Watch "how to get scrollbar events" New topic
Author

how to get scrollbar events

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I want to create a table that can be set the viewable size so that if visible size is larger than the table size, scroll bar will automatically appear. Someone helped me by using this:

<DIV STYLE="width:416px;height:200px;overflow-y:auto;">
<TABLE STYLE="width:400px;" BORDER="1"> .....

Now I want to get scrollbar events from this automatically generated scrollbar, which doesn't have an id. How can I get events from it?

Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You mean onscroll?

Eric
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I'm not sure. I want to do something based on where the scroll position button is, then do the corresonding thing. Say, data to be displayed is divided into 3 parts. Initially the 1st part is loaded. If the scroll position button is being moved to the middle of the bar, or passed a certain length, then load the 2nd part of the data, if scroll position button is being moved down to the bottom, then the last part is loaded.

How could I do this?
Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
But the thing is if this data is not loaded, how would the scrollbar know how far it is need to scroll?

Eric
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I would think, if the user scroll it down and pass the half of bar length, then, I load the next part of the data. I hope this scenario would work.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Problem is this if you do not have that data on the page, then the scrollbar will not be that long for the person to scroll half way.

If this data in a table and you know how many rows, then you would be able to create a blank table with X number of rows and fill it in with Ajax. This has been done before, do not remember the link where it is at.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get scrollbar events