TESTO MACCHINA DA SCRIVERE 2

La scrittura inizia a scrivere riga per riga, per poi riprendere dall'inizio.

RITORNA ALLA PAGINA DELLE JAVASCRIPT

RITORNA ALLA PAGINA DEGLI EFFETTI MACCHINA DA SCRIVERE

utenti connessi

Lo script da inserire in html

<SCRIPT LANGUAGE="JavaScript">

status = "Corso di JavaScript gestito da Ingargiola Salvatore"

var line=new Array()

line[1]="questa è la riga 1"

line[2]="questa è la riga 2"

line[3]="questa è la riga 3"

 

// * Impostazione della dimensione del carattere * \\

var ts_fontsize="14px"

var longestmessage=1

for (i=2;i<line.length;i++){

if (line[i].length>line[longestmessage].length)

longestmessage=i

}

var tscroller_width=line[longestmessage].length

lines=line.length-1

if (document.all||document.getElementById){

document.write('<form name="bannerform">')

document.write('<input type="text" name="banner" size="'+tscroller_width+'"')

document.write(' style="background-color: '+document.bgColor+'; color: '+document.body.text+'; font-family: verdana; font-size: '+ts_fontsize+'; font-weight:bold; border: medium none" onfocus="blur()">')

document.write('</form>')

}

temp=""

nextchar=-1;

nextline=1;

cursor=" "

function animate(){

if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){

nextline++;

nextchar=-1;

document.bannerform.banner.value=temp;

temp="";

// * Impostazione velocità di sostituzione linea di scrittura * \\

setTimeout("nextstep()",5000)

}

else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){

nextline=1;

nextchar=-1;

document.bannerform.banner.value=temp;

temp="";

// * Attesa prima riprendere dall'inizio * \\

setTimeout("nextstep()",3000)

}

else{

nextstep()

}

}

function nextstep(){

if (cursor=="1"){

cursor="15"}

else if (cursor=="2"){

cursor="6"}

else if (cursor=="3"){

cursor="9"}

else if (cursor=="5"){

cursor="4"}

nextchar++;

temp+=line[nextline].charAt(nextchar);

document.bannerform.banner.value=temp+cursor

// * Impostazione velocità di scrittura * \\

setTimeout("animate()",50)}

if (document.all||document.getElementById)

window.onload=animate

</script>