Click to See Complete Forum and Search --> : Scrolling a loaded html page in a frameset?


leonard_770
05-14-2003, 06:01 AM
I have a frameset containing 2 frames;
a top-frame 'menu', that contains button
and a center-frame 'content' that contains
text images etc.
The page size is h:450 w:750

My problem is that when you click a button
I'd like to load another page in then center-frame
but then once it's loaded the page scrolls to an
x co-ordinate of 1500 using the 'scrollit' script below.

Does anyone know how to do this?

Thanks for your help,

Lenny.


function scrollit(dest) {

dx = Math.abs(dest - x) / 30;
if (dx>50) { dx = 50; }
dx2 = 1;
if (dest < x) { dx2 = -1;}

while(dest != x) {
// check arithmetic retardation
if ((dx+1)*(dx+2)/2 <= Math.abs(x-dest)) {
dx = dx + 1;
} else {
if (dx*(dx+1)/2 > Math.abs(x-dest)) {
dx = dx - 1;
}
}
x = x + dx*dx2;
if (dx>50) { dx = 50; }

parent.mid.scrollTo(x, 0);
}
}

khalidali63
05-14-2003, 06:29 AM
it looks like it should work,however,the scrollTo function take param like this

scrollTo(x-coords,y-coords);

where y-coords will scroll to the top/bottom of the page
and x-coords will scroll to the left-right of the page

I hope it helps

leonard_770
05-14-2003, 06:37 AM
Thanks for your reply khalidali63.

Yes when I put 'scrollit(750);' on the button the page scrolls to that co-ordinate.

But the problem is that first I want to load a new html page, (school.htm), in the frame and then it scrolls this page to x=750.

I was thinking of calling up, from the button, an external .js file that loads the url and then tells it to move to the co-ordinates but I don't know how to do it.

Any ideas,

Thanks,

Lenny.

khalidali63
05-14-2003, 06:39 AM
did you try onload event call in the body tag? that should do this for you...

leonard_770
05-14-2003, 09:12 AM
I only want this as a 'once-of' effect and not every time the page re-loads as I there will be buttons to scroll this frame//page to different co-ordinates once it's loaded and has moved to it's starting position.

Thanks,

Lenny.