Ticker
Christian82
- javascript
0 Lutz T.
Hallo,
weiß von euch jemand warum dieser Ticker nicht richtig funktioniert? Der Text ist anscheinend zu lang und wird deshalb abgeschnitten...
<html>
<head>
<title>Text Ticker</title>
<style type="text/css">
<!--
.ticker {
background-color : #96172C; ; font-family: Verdana; font-size: 10px; border: #96172C; color: #FFFFFF}
-->
</style>
</head>
<body onload="marquee()">
<p>
<script language="JavaScript">
<!--
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
function marquee() {
var i,k,msg=" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 +++ ";
k=(75/msg.length)+1;
for(i=0;i<=k;i++) msg+=" "+msg;
document.marqueeform.marquee.value=msg.substring(position,position+120);
if(position++==69) position=0;
id=setTimeout("marquee()",1000/10); }
function action() {
if(!pause) {
clearTimeout(id);
pause=1; }
else {
marquee();
pause=0; } }
// -->
</script>
<form name="marqueeform">
<input type="text" name="marquee" size="60" class="ticker">
</form>
</body>
</html>
Danke im Voraus,
Christian
Hallo Christian,
weiß von euch jemand warum dieser Ticker nicht richtig funktioniert? Der Text ist anscheinend zu lang und wird deshalb abgeschnitten...
Ja weiß ich, weil er nicht ordentlich programmiert war.
Ich habs mal verbessert.
Gruß, Lutz
<html>
<head>
<title>Text Ticker</title>
<style type="text/css">
<!--
.ticker {background-color : #96172C; ; font-family: Verdana; font-size: 10px; border: #96172C; color: #FFFFFF}
-->
</style>
</head>
<body onload="marquee()">
<p>
<script language="JavaScript">
<!--
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0,maxlen=60;
var msg=" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 +++ ";
//msg="123 +++";
var msglen=msg.length;
var marq_msg=msg+" "+msg;
while (marq_msg.length<2*maxlen) marq_msg+=" "+msg;
function marquee()
{ document.marqueeform.marquee.value=marq_msg.substring(position,position+maxlen);
if(position++==msglen) position=0;
id=setTimeout("marquee()",100);
}
function action()
{ if(!pause)
{ clearTimeout(id);
pause=1;
}
else
{ marquee();
pause=0;
}
}
// -->
</script>
<form name="marqueeform">
<input type="text" name="marquee" size="60" class="ticker">
</form>
</body>
</html>