<html>
<head>
<title>
ticker
</title>
<script type="text/javascript">
function ticker() {
var tb = document.getElementById("tb");
var tb_scroll = document.getElementById("tb_scroll");
var text = " Leerzeichen? ";
var tbm = "<div id='tbm1' class='tbm'>"+text+"</div><div id='tbm2' class='tbm'>"+text+"</div>";
var z = 0;
var s = 0;
tb_scroll.innerHTML = tbm;
var tbm1 = document.getElementById("tbm1");
var tbm2 = document.getElementById("tbm2");
var pk = tbm2.offsetLeft-tbm1.offsetWidth;
tb_scroll.style.width = tbm1.offsetWidth*2;
var anzahl = Math.ceil(tb.offsetWidth/tbm1.offsetWidth)+1; //Anzahl wie oft die TBM in die TB passt -> Aufrunden auf nächst höhere ganze Zahl
if(anzahl > 2){
tbm = new Array();
for(z=1; anzahl >= z; z++) {
tbm[z] = "<div id='tbm"+z+"' class='tbm'>" + "\r\n " +text+ "\r\n " + " </div>";
}
tb_scroll.style.width = tbm1.offsetWidth*anzahl+10;
tb_scroll.innerHTML = tbm.join(" ");
}
tbm1 = document.getElementById("tbm1");
tbm2 = document.getElementById("tbm2");
pk = tbm2.offsetLeft-tbm1.offsetWidth;
tb_scroll.onmouseover = wechsel;
tb_scroll.onmouseout = wechsel;
function wechsel() {
if(s == 0) {
s = 1;
} else {
s = 0;
tbs();
}
}
function tbs() {
if(s == 0) {
if(tb_scroll.offsetLeft-pk == tbm1.offsetWidth*-1 ) {
tb_scroll.style.marginLeft = 0;
z = 0;
}
z++;
tb_scroll.style.marginLeft = z*-1;
stop = window.setTimeout(function(){tbs();}, 40);
if(z == tbm1.offsetWidth+1) clearTimeout(stop);
}
}
tbs();
}
</script>
<style type="text/css">
body { overflow:hidden; }
#tb { border:1px solid black; white-space:nowrap; overflow:hidden; width:400px; }
#tb_scroll { margin-left:0px; font:bold 11px verdana; width:1px; cursor:default; }
.tbm { float:left; background-color:gold; }
</style>
</head>
<body onload="ticker();">
<div id="tb">
<div id="tb_scroll">
</div>
</div>
</body>
</html>