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
#===============================================================================
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
#===============================================================================