php script help needed

January 22nd, 2020

i would like to have a script where you see a text as it is writing
hard to explain lol
here is an example:
http://www.snopes.com/badpage
can anyone help me with this?

Answer #1
It’s not a Php script. It’s Javascript. The creator simply scanned through an array containing text and edited the value of the text area with it. Here’s the script from the site:
<script language="Javascript">
var tl=new Array("text1","text2","text3","text4");
var speed=60;
var index=0; text_pos=0;
var str_length=tl[0].length;
var contents, row;
function type_text(){
  contents='';
  row=Math.max(0,index-7);
  while(row<index)
    contents += tl[row++] + '\r\n';
  document.forms[0].elements[0].value = contents + tl[index].substring(0,text_pos) + "_";
  if(text_pos++==str_length)
  {
    text_pos=0;
    index++;
    if(index!=tl.length)
    {
      str_length=tl[index].length;
      setTimeout("type_text()",1500);
    }
  } else
    setTimeout("type_text()",speed);
 
}
</script>

After that set an event to run the function. For example create a button and add an onclick event like this one:
onclick="type_text();"
Also, don’t forget to define your textarea like this:
<form><textarea rows=8 cols=70 wrap=soft></textarea></form>
Good luck mate ^_^

 

| Sitemap |