PDA

View Full Version : [PHP] con effetti di testo ?


CrashBack
03-04-2009, 16:42
Salve - Vengo subito al dunque ........dovrei aggiungere un effetto stile macchina da scrivere ( text teletype ) al testo che viene recuperato da un database Mysql

ho provato in vari modi ma non ho ottenuto alcun risultato
ad esempio con il Tag TT :


echo "<a><TT> $testo </a></TT><br>";


Conoscete una soluzione ?

Di seguito posto alcuni esempi di codice stile telescrivente :


<html>
<head>
<title>Effetto Macchina da scrivere</title>
</head>
<script language=Javascript>
<!-- begin
var max=0;
function textlist()
{
max=textlist.arguments.length;
for (i=0; i<max; i++)
this[i]=textlist.arguments[i];
}
tl=new textlist
(
"testo testo testo testo",
"testo testo testo",
"testo testo testo"
);
var x=0; pos=0;
var l=tl[0].length;
function textticker()
{
document.tickform.tickfield.value=tl[x].substring(0,pos)+"|";
if(pos++==l) { pos=0; setTimeout("textticker()",1000); x++;
if(x==max) x=0; l=tl[x].length; } else
setTimeout("textticker()",50);
}
// end -->
</script>
</head>

<body onload="textticker()">

<form name="tickform"><input type=text name="tickfield" size=40></form>
</body>
</html>





OPPURE :


<html>
<head>
</head>
<body>
<br><br><br><br>
<script language="JavaScript1.2">
<!--
var it=0
var head="display:''"
function initialize(){
mytext=typing.innerText
var myheight=typing.offsetHeight
typing.innerText=''
document.all.typing.style.height=myheight
typeit()
}
function typeit(){
typing.insertAdjacentText("beforeEnd",mytext.charAt(it))
if (it<mytext.length-1){
it++
setTimeout("typeit()",100)
}
else
return
}
if (document.all)
document.body.onload=initialize
-->
</script>
<span id="typing" style="visiblity:hidden;height:2" style=&{head};>Bla bla bla bla bla bla </span>
</body>
</html>



Grazie in anticipo per un'eventuale risposta

Pappe
03-04-2009, 18:10
<pre>testo stile macchina da scrivere</pre> dovrebbe funzionare....

CrashBack
03-04-2009, 18:37
Ciao Pappe

Il testo deve risultare animato come negli esempi che ho postato ...

<pre>testo stile macchina da scrivere</pre> dovrebbe funzionare....

E con la variabile $testo come faccio dove la metto ?

Attualmento $testo si trova nell'echo e mi visualizza il testo trovato nel database :


echo "<a> $testo </a><br>";


Ciao e grazie per adesso !

fabricop
03-04-2009, 20:27
Ciao,
usa il secondo script che hai postato e sostituisci la riga

<span id="typing" style="visiblity:hidden;height:2" style=&{head};>Bla bla bla bla bla bla </span>

con

<span id="typing" style="visiblity:hidden;height:2" style=&{head};><?php echo $testo; ?></span>

CrashBack
03-04-2009, 22:24
Ciao,
usa il secondo script che hai postato e sostituisci la riga

<span id="typing" style="visiblity:hidden;height:2" style=&{head};>Bla bla bla bla bla bla </span>

con

<span id="typing" style="visiblity:hidden;height:2" style=&{head};><?php echo $testo; ?></span>



Siete straordinari FUNZIONA !!!!!!!!!!!!!!

:mano:


Non ci posso credere , questa cosa mi ha fatto ammattire

finalmente va .....

Quindi Php non č cosė limitato per come pensavo ?

Davvero sorprendente -- ancora Grazie !!!!!