Код: Выделить всё
function scroll(oid, iid) {
this.oCont = document.getElementById(oid)
this.ele = document.getElementById(iid)
this.width = this.ele.clientWidth;
this.n = this.oCont.clientWidth;
this.move = function() {
this.ele.style.left = this.n + "px"
this.n--
if (this.n < (-this.width)) {
this.n = this.oCont.clientWidth
}
}
}
var vScroll
function setup() {
vScroll = new scroll("oScroll", "scroll");
setInterval("vScroll.move()", 20)
}
onload = function() {
setup()
}
Код: Выделить всё
#scroll {
position: absolute;
white-space: nowrap;
top: 0px;
left: 200px;
}
#oScroll {
margin: 0px;
padding: 0px;
position: relative;
width: 200px;
height: 20px;
overflow: hidden;
}
Код: Выделить всё
This is the scrolling text
Подробнее здесь: https://stackoverflow.com/questions/223 ... -scrolling