//variable con el texto a mostrar
var texto = "Este es un molesto ejemplo javascrip"
//variable con la posicion en el texto. Inicializar siempre a 0
var pos = 0

function dame_texto(){
    //incremento la posicion en 1 y extraigo el texto a mostrar en este momento.
   pos = pos + 1
    if (pos == texto.length){
       //si hemos llegado al final, volvemos la posición al principio
      pos = 0
      return texto
   }else{
   return texto.substring(0,pos)
  }
}

function anima_texto(){
    xInnerHtml('textomovimiento',dame_texto())
   setTimeout("anima_texto()",100)
} 
