[Javascript] gradual scroll from another frame.
ivan lópez
ivan at textzi.net
Fri Dec 17 17:14:38 CST 2004
hi People,
This is my first shot at javascript, so please bear with me : )
I have a frame set up that looks like this:
| | |
| | |
| frame 1 | frame 2 |
| | |
| | |
I'm trying to "gradually" scroll frame 1 by pressing on a radio button
in frame 2. Copying&pasting, I wrote the following, which gives me the
effect I want when there are no frames, ie it "gradually" scrolls a
window:
var x=0;
function escrol()
{
if (x<1190) {
window.scroll(0, x);
x=x+10;
setTimeout('escrol()', 100);
}
else {
if (x=1190) {
window.scroll(0, x);
x=x+10;
scrolldelay=setTimeout('escrol()', 100);
}
else {
clearTimeout(scrolldelay);
}
}
}
.....
<form>
<input type=radio onClick=escrol()>
</form>
I tried to adapt what I found in this thread:
https://lists.latech.edu/pipermail/javascript/2003-December/006781.html
I changed my code a bit and put it in the <head> of frame 2, but it
doesn't seem to work:
var x=0;
var frameone = parent.top.frames["one"];
function escrol()
{
if (x<1190) {
frameone.window.scroll(0, x);
x=x+10;
setTimeout('escrol()', 100);
}
else {
if (x=1190) {
frameone.window.scroll(0, x);
x=x+10;
scrolldelay=setTimeout('escrol()', 100);
}
else {
clearTimeout(scrolldelay);
}
}
}
What am I doing wrong?
Thanks a lot,
ivan
More information about the Javascript
mailing list