Stop and continuet after 3000 chars

S

skieros

Any idea why after the counter reaches 3000 chars when i hit a button
doesnt continue displayign text?
Deos it work for you?

#===============================================================================
print <<ENDOFHTML;
<script type='text/javascript'>

var textToShow = "$data";
var tm;
var pos = 0;
var counter = 0;

function init()
{ tm = setInterval("type()", 50) }

function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("DivText");
c = textToShow.charAt(pos++);

if (c.charCodeAt(0) != 10)
d.appendChild(document.createTextNode(c));
else
d.appendChild(document.createElement("br"));

counter++;

if (counter >= 3000 && (c.charCodeAt(0) == 10 || c == "."))
{
d.appendChild(document.createElement("br"));
d.appendChild(document.createTextNode("ÐÜôá Ýíá ðëÞêôñï ãéá
óõíÝ÷åéá..."));
counter = 0;
clearInterval(tm);
document.body.onkeypress = function () {
document.getElementById("DivText").innerHTML = '';

tm = setInterval("type()", 50);
document.body.onkeypress = null; };
}
}
else
clearInterval(tm);
}
</script>

<body onload=init()>
<center>
<div id="DivText" align="Left" style="
overflow: auto;
background-image: url(/data/images/vortex.jpg);
border: Ridge Magenta 5px;
width: 1100px;
height: 750px;
color: Cyan;
font-family: Bookman;
font-size: 16px;">
</div>
ENDOFHTML
#===============================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top