|
i have an html page displaying stocks values. an input for writing the stock symbol and a button search for getting the stock value from database. And on top of the form a scroll message dispaying top 5 stock values.
Now when i hit the button search several times, an undefined message text is displayed then after some time, the scroll message works good again.
here is the scroll script that i used. So why is that? any solution
var scrollerdelay='1'
var scrollerwidth='600px'
var scrollerheight='74px'
var scrollerbgcolor=''
//set below to '' if you don't wish to use a background image
var scrollerbackground=''
//configure the below variable to change the contents of the scroller
var scrollingMessages=new Array()
var time;
///////Do not edit pass this line///////////////////////
var ie=document.all
var dom=document.getElementById
if (scrollingMessages.length>2)
i=2
else
i=0
function move(whichdiv)
{
tdiv=eval(whichdiv)
if (tdiv.innerHTML == 'undefined')
{
tdiv.innerHTML ='';
time = setTimeout("move2(second2_obj)",scrollerdelay)
return;
}
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.t op)<=5)
{
tdiv.style.top=0+"px"
time = setTimeout("move(tdiv)",scrollerdelay)
time = setTimeout("move2(second2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1)
{
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
time = setTimeout("move(tdiv)",50)
}
else
{
tdiv.style.top=parseInt(scrollerheight)+"px"
tdiv.innerHTML=scrollingMessages[i]
if (i==scrollingMessages.length-1)
i=0
else
i++
}
}
function move2(whichdiv)
{
tdiv2=eval(whichdiv)
if (tdiv2.innerHTML == 'undefined')
{
tdiv2.innerHTML ='';
time = setTimeout("move2(first2_obj)",scrollerdelay)
return;
}
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style .top)<=5)
{
tdiv2.style.top=0+"px"
time = setTimeout("move2(tdiv2)",scrollerdelay)
time = setTimeout("move(first2_obj)",scrollerdelay)
scrollerdelay='7000';
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1)
{
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
time = setTimeout("move2(second2_obj)",50)
}
else
{
tdiv2.style.top=parseInt(scrollerheight)+"px"
tdiv2.innerHTML=scrollingMessages[i]
if (i==scrollingMessages.length-1)
i=0
else
i++
}
}
function startscroll()
{
first2_obj=ie? first2 : document.getElementById("first2");
second2_obj=ie? second2 : document.getElementById("second2");
move(first2_obj);
second2_obj.style.top=scrollerheight;
second2_obj.style.visibility='visible';
}
function stopscroll()
{
if (time) clearTimeout(time);
}
|