• Hi! I want to add to my wordpress blog a typewriter effect. I was trying with javascript in a simple html page and it works fine. But was not posibble to run that on the wordpress structure. Any idea?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Can you elaborate on this typewriter effect? Can we see that simple html page which has the effect?

    Thread Starter lw2dtq

    (@lw2dtq)

    This is teh simple html page:

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
    <html>
    <head>

    <title>Titulo de la pagina</title>
    </head>

    <body>

    <div id=”ticker”>
    <H2 class=”ticker” id=”mtxt”></H2>
    <br class=”sep” clear=”all”>
    <SCRIPT LANGUAGE=”JavaScript”>
    function stringreplace(str,srchfor,rplwith){
    while (str.indexOf(srchfor)>-1) {
    pos= str.indexOf(srchfor);
    str = “” + (str.substring(0, pos) + rplwith + str.substring((pos + srchfor.length), str.length));
    }
    return str;
    }
    // Pasarela de Noticias
    var listanoticias=new Array();
    var conteo=0; // item actual
    var actual = “”;
    var definitivo = “”
    var i=-1; // letra que se esta tipeando

    var caracteresbuenos = new Array(‘á’, ‘é’, ‘í’, ‘ó’, ‘ú’, ‘?’, ‘?’,’?’, ‘?’, ‘”‘, ‘?’, ‘?’,’ü’, ‘“’, ‘”’);
    var caracteresmalos = new Array(‘á’, ‘é’, ‘í’, ‘ó’, ‘ú’, ‘ñ’, ‘Ñ’,’¿’, ‘¡’, ‘"’, ‘Ç’, ‘ç’,’ü’, ‘“’, ‘”’);

    function newsticker(){
    // proximo caracter del item actual
    for (var x = 0; x <= caracteresbuenos.length; x++){
    listanoticias[conteo][0] = stringreplace(listanoticias[conteo][0],caracteresmalos[x],caracteresbuenos[x]);
    }
    if (i < listanoticias[conteo][0].length – 1){
    i++;
    temp1 = listanoticias[conteo][0];
    temp1 = temp1.split(”);
    actual = actual + temp1[i];
    temp2 = listanoticias[conteo][1];
    document.getElementById(‘mtxt’).innerHTML = “<span class=rj>”+actual+”</span><span class=t07a>|</span>”;
    setTimeout(‘newsticker()’,50)
    return;
    }
    // item nuevo
    i = -1;
    actual = “”;
    if (conteo<listanoticias.length-1)
    conteo++;
    else
    conteo=0;
    setTimeout(‘newsticker()’,5000)
    }
    var ii = 0;

    listanoticias[ii]=new Array(“This is the text. Just an example”,””)

    setTimeout(‘newsticker()’,2001)
    </script>
    </div>

    </body>
    </html>

    How did you add the script on your wordpress installation? You can’t insert that when you write your post. But you can insert it to index.php

    Thread Starter lw2dtq

    (@lw2dtq)

    I don’t need at the moment insert the effect in a post. I have insert that in the index.php but does not work.

    To run a script in a dynamic document, the first thing is to take the script and create a folder for it on your server. It could be your theme directory, or your root directory. doesn’t really matter.

    Then call the script in your header

    Now you can use html tags to use the script anywhere you want, in the header, in the sidebar, in a post.

    Html will parse just fine.

    If you’re getting errors, my first thought is permissions, then correct paths to the script, then the tags you’re using to call the script, and finally, the script itself.

    Thread Starter lw2dtq

    (@lw2dtq)

    Thanks, but does not work for me. I will try again

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Typewriter effect?’ is closed to new replies.