NancyJ
08-09-2005, 02:47 PM
I have this script <Script Language=JavaScript>
var n2 = 0;
var currPos2 = 0;
var newPos2 = 1;
var isDiv2 = "";
var pauseFlag2 = true;
var isDelay2 = "";
function startScroll2(){
if (newPos2 > currPos2 && pauseFlag2)
{
currPos2 = isDiv2.scrollTop;
n2 = n2+1; // adjust '3' for speed control
isDiv2.scrollTop = n2;
newPos2 = isDiv2.scrollTop;
isDelay2 = setTimeout('startScroll2()',35) // adjust '20' for speed control
}
else if (newPos2 == currPos2)
{
if (pauseFlag2){setTimeout("toBottom2()",0)};
}
}
function toBottom2(){
n2 = 0;
currPos2 = 0;
newPos2 = 1;
isDiv2 = document.getElementById('div2');
isDiv2.scrollTop = 0;
setTimeout('startScroll2()',0); // adjust '2000' for speed
isDiv2.onmouseover=function(){pauseFlag2 = false;clearTimeout(isDelay2)}
isDiv2.onmouseout=function(){pauseFlag2 = true;startScroll2()}
}
function startStuff(){
toBottom2();
transformPic();
}
window.onload=startStuff;
</Script>
which beautifully scrolls the content of div2 but the text goes all the way off the screen before it starts again... but the client doesnt want there to be any gap. At first I thought it couldnt be done... but then I had an idea - what if there were two copies of the content so that when the first one finished it would go to the bottom and then loop around again. Can anyone help me modify this script to do that? Also, I cannot use any css positioning for this page.
var n2 = 0;
var currPos2 = 0;
var newPos2 = 1;
var isDiv2 = "";
var pauseFlag2 = true;
var isDelay2 = "";
function startScroll2(){
if (newPos2 > currPos2 && pauseFlag2)
{
currPos2 = isDiv2.scrollTop;
n2 = n2+1; // adjust '3' for speed control
isDiv2.scrollTop = n2;
newPos2 = isDiv2.scrollTop;
isDelay2 = setTimeout('startScroll2()',35) // adjust '20' for speed control
}
else if (newPos2 == currPos2)
{
if (pauseFlag2){setTimeout("toBottom2()",0)};
}
}
function toBottom2(){
n2 = 0;
currPos2 = 0;
newPos2 = 1;
isDiv2 = document.getElementById('div2');
isDiv2.scrollTop = 0;
setTimeout('startScroll2()',0); // adjust '2000' for speed
isDiv2.onmouseover=function(){pauseFlag2 = false;clearTimeout(isDelay2)}
isDiv2.onmouseout=function(){pauseFlag2 = true;startScroll2()}
}
function startStuff(){
toBottom2();
transformPic();
}
window.onload=startStuff;
</Script>
which beautifully scrolls the content of div2 but the text goes all the way off the screen before it starts again... but the client doesnt want there to be any gap. At first I thought it couldnt be done... but then I had an idea - what if there were two copies of the content so that when the first one finished it would go to the bottom and then loop around again. Can anyone help me modify this script to do that? Also, I cannot use any css positioning for this page.