Advanced Search

Results 1 to 2 of 2

Thread: Typing Text help -- repetition

  1. #1
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Try:
    Code:
    <small><span id="typing">Lorem ipsum dolor sit amet, consectetuer adipiscing
    elit. Phasellus risus nisl, vehicula in, hendrerit vitae, iaculis vel, nisl. Praesent rhoncus
    semper velit. Ut sed nunc. Proin id metus eget neque consectetuer semper. Donec
    consectetuer auctor nisl. Sed metus. Sed eu felis. Sed accumsan bibendum leo. Mauris
    accumsan dapibus odio. Pellentesque habitant morbi tristique senectus et netus et
    malesuada fames ac turpis egestas. Integer sodales dui ac justo.<br/><br/>
    Donec ante nulla, suscipit quis, pharetra id, consectetuer non, magna. Phasellus viverra
    lobortis eros. Integer eu arcu. Praesent accumsan nunc ac ante mollis cursus. Class
    aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.
    Aenean volutpat enim vitae turpis. Vestibulum sit amet nunc. Maecenas nunc turpis,
    cursus eu, vulputate sed, pretium id, urna. Suspendisse potenti.</span></small>
    
    <script type="text/javascript">
    
    /*
    Typing Text Script
    Last updated: 18/11/05
    &#169; Dynamic Drive (www.dynamicdrive.com)
    For full source code, installation instructions,
    hundreds more DHTML scripts, and Terms Of
    Use, visit http://www.dynamicdrive.com/.
    
    Rewritten by Twey to be compatible with Firefox
    (and now Konqueror and presumably Safari).
    The script will strip all HTML tags from the text, but
    non-supporting browsers won't.  This will allow you to
    hide the text or display differently on such browsers.
    */
    
    interval = 100; // Interval in milliseconds to wait between characters
    
    if(document.getElementById) {
      t = document.getElementById("typing");
      if(t.innerHTML) {
        typingBuffer = ""; // buffer prevents some browsers stripping spaces
        it = 0;
        mytext = t.innerHTML;
        t.innerHTML = "";
        typeit();
      }
    }
    
    function typeit() {
      mytext = mytext.replace(/<([^<])*>/, "");     // Strip HTML from text
      if(it < mytext.length) {
        typingBuffer += mytext.charAt(it);
        t.innerHTML = typingBuffer;
        it++;
        setTimeout("typeit()", interval);
      } else {
        t = document.getElementById("typing");
        if(t.innerHTML) {
          typingBuffer = ""; // buffer prevents some browsers stripping spaces
          it = 0;
          mytext = t.innerHTML;
          t.innerHTML = "";
          typeit();
        }
      }
    }
    </script>
    hey.. i m quite new to this. hope u can help me out. i wan my text to repeat 'typing'. i tried the above code but it doesnt really work for me. can u guide me? wher exactly i shud place this code?
    Last edited by tech_support; 04-25-2007 at 08:33 AM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That code is outdated now, there's a new object-oriented version available whose .run() function can be called at an interval or via a callback.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •