Codice PHP:TextField.prototype.setText = function(str) {
this.text = "";
this.destinationText = str;
this.count = 0;
this.numLoops = 1;
if (this.timer) {
clearInterval(this.timer);
}
this.timer = setInterval(this, "writeString", 3);
updateAfterEvent();
};
TextField.prototype.getLetter = function() {
var a = "234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
return (a.charAt(Math.floor(Math.random()*a.length-1)));
};
TextField.prototype.writeString = function() {
if (this.destinationText.length*this.numLoops>=this.count) {
var c = "";
var b = 0;
while (b<this.destinationText.length) {
if (this.destinationText.charAt(B) != " ") {
if (Math.floor(this.count/this.numLoops)>b) {
c = c+this.destinationText.charAt(B);
} else {
c = c+this.getLetter();
}
} else {
c = c+" ";
}
b++;
}
this.text = c;
this.count++;
} else {
this.text = this.destinationText;
clearInterval(this.timer);
}
updateAfterEvent();
};
con questo script creo un'effetto sul testo, l'effetto viene richiamato digitando la funzione setText ="testo da scrivere" per sommi capi...
adesso io vorrei che il testo fosse richiamto da un file TXT caricato esternamente, come posso fare ?
grazie a tutti !

Rispondi quotando