Using DHTMLLib and CSS, you can add auto-scrolling boxes to your web-page with a minimal amount of code. Using the buttons above, you can change the direction of the marquee.
var sRepeat=null
function doMarquee(dir, src, amount) {
if (window.document.readyState=="loading")
alert("Please wait until the page is finished loading.")
if (amount==null) amount=10
switch (dir) {
case "up":
document.all[src].style.pixelTop-=amount
if (-document.all[src].style.pixelTop>=document.all[src].offsetHeight)
document.all[src].style.pixelTop=document.all[src].offsetParent.offsetHeight
break;
case "down":
document.all[src].style.pixelTop+=amount
if (document.all[src].style.pixelTop>document.all[src].offsetParent.offsetHeight)
document.all[src].style.pixelTop = -document.all[src].offsetHeight
break;
case "left":
document.all[src].style.pixelLeft-=amount
if (-document.all[src].style.pixelLeft>=document.all[src].offsetWidth)
document.all[src].style.pixelLeft=document.all[src].offsetParent.offsetWidth
break;
case "right":
document.all[src].style.pixelLeft+=amount
if (document.all[src].style.pixelLeft>document.all[src].offsetParent.offsetWidth)
document.all[src].style.pixelLeft = -document.all[src].offsetWidth
break;
}
return false
}
function RunMarquee(sDir,sWhich,iAmount) {
clearInterval(sRepeat)
if (!iAmount) iAmount=10
sRepeat = setInterval("doMarquee('"+sDir+"','"+sWhich+"'," + iAmount+")",100)
}
function doLoad() {
setup()
window.document.all.s1.ondragstart = new Function("return false")
RunMarquee("right","s1")
}
window.onload = doLoad