The only way I can think to do a postback on a 3 second delay right now is like this.
setInterval("__doPostBack('UpdatePanel1', '' )", 3000);
The problem I run into is that it posts back every 3 seconds. Is there a better way to do this or a way to clear interval on this? I am using an asp updatepanel control.
Here is my complete javascript code to give you an idea of what I am trying to do:
var delayb4scroll = 1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed = 2 //Specify marquee scroll speed (larger is faster 1-10)
var pauseAtBottom = 3000 //Pause at the end of the scroll for this many seconds (3000 = 3 seconds)
var copyspeed = marqueespeed
var actualheight = ''
var boolRunOnce = ''
function pageLoad() {
initializemarquee();
}
function scrollmarquee() {
if (parseInt(cross_marquee.style.top) - 975 > (actualheight * (-1) + 8)) //if scroller hasn't reached the end of its height
cross_marquee.style.top = parseInt(cross_marquee.style.top) - copyspeed + "px" //move scroller upwards
else { //else, scrollbar has reached the bottom, display for 3 seconds then postback
setInterval("__doPostBack('UpdatePanel1', '' )", 3000);
}
}
function initializemarquee() {
cross_marquee = document.getElementById("vmarquee")
cross_marquee.style.top = 0
marqueeheight = document.getElementById("marqueecontainer").offsetHeight
actualheight = cross_marquee.offsetHeight //height of marquee content (much of which is hidden from view)
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}
will run only once.
or you can use the return value from setInterval as a reference to your interval thread, which can then be cleared;
Edit: correct, function syntax added as per comments.