Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Typing Text Run only 1 ID at a time when wanted

  1. #1
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Typing Text Run only 1 ID at a time when wanted

    Hi all

    i have been reading this forum for hrs and hrs but can't seem to find what i need so maybe you could help me

    I'm using Typing Text Script from this website

    i have 2 lots of text typed out 1 when the page loads and 1 when a button is clicked to activate a hidden layer of text so as it is i have this

    Code:
    <script type="text/javascript">
    
    //Define first typing text:
    
    
    //Define second typing text (use "slashing" cursor at the end):
    new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    new TypingText(document.getElementById("SText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    //Type out examples:
    TypingText.runAll();
    </script>
    Now i know that the TypingText.runAll(); is what makes it start typing out the text but how can i stop this from running them all on load and only get it to run the first AText and then to run SText once i add it as a behaviour onclick

    as if i add a onclick behaviour to call script TypingText.runAll(); it runs all the typing again and i only want it to run the 1 line i pick

    Please Help!!! lol

    Thanks in advance i see from alot of the posts around here you guys are good at helping and know your stuff so thank you
    Last edited by Taz89; 09-21-2012 at 09:48 AM. Reason: Resolved See Last Post

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Please use encase your code in [code] tags when posting code.
    Code:
    <script type="text/javascript">
    
    //Define first typing text:
    
    
    //Define second typing text (use "slashing" cursor at the end):
    functin aText(){
    var a = new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    typingText.run(a);
    }
    function sText(){
    var s = new TypingText(document.getElementById("SText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    typingText.run(s);
    }
    </script>
    As you can see, there is a function aText and sText, in the body, put:
    Code:
    <body onload="aText">
    and then on the thing you want to click, say a button:
    Code:
    <button onclick="sText">
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. The Following User Says Thank You to bernie1227 For This Useful Post:

    Taz89 (09-21-2012)

  4. #3
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    hi thanks bernie i just try this copy and pasted your code and even try into a blank page with only this on it and some test still don't work can't seem to make it work

    anything i'm missing ? this is what i made in a blank page that did not work

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Text And More Text And More Text</title>
    <script type="text/javascript" src="TypingText.js">
    /****************************************************
    * Typing Text script- By Twey @ Dynamic Drive Forums
    * Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
    * This notice MUST stay intact for legal use
    ****************************************************/
    </script>
    
    </head>
    
    <body onload="aText">
    
    <div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="AText">
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text Click button >> <button onclick="aText"></div>
    
    <script type="text/javascript">
    
    //Define first typing text:
    
    
    //Define second typing text (use "slashing" cursor at the end):
    function aText(){
    var a = new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    typingText.run(a);
    }
    </script>
    </body>
    
    </html>

  5. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Code:
    <body onload="aText">
    Should be:
    Code:
    <body onload="aText()">
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  6. #5
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hi bernie i did give that a try last night when it did not work i looked up on code with functions etc and i did see that but even that don't work not even clicking the button works even if you add the () it still don't work with the load or button

    Thanks

  7. #6
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    looking at your code, there's a few problems, 1. you should probably put the javascript in the head
    2. you never ended the tag for the button.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  8. #7
    Join Date
    Sep 2012
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bernie1227 View Post
    looking at your code, there's a few problems, 1. you should probably put the javascript in the head
    2. you never ended the tag for the button.
    i have now done both of what you said but still don't work if you would like open a new blank html page and past this in as this is the hole page i using for testing its just a blank page with the script in

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Text And More Text And More Text</title>
    <script type="text/javascript" src="TypingText.js">
    /****************************************************
    * Typing Text script- By Twey @ Dynamic Drive Forums
    * Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
    * This notice MUST stay intact for legal use
    ****************************************************/
    </script>
    <script type="text/javascript">
    
    //Define first typing text:
    
    
    //Define second typing text (use "slashing" cursor at the end):
    function LoadText(){
    var a = new TypingText(document.getElementById("Text"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
    typingText.run(a);
    }
    </script>
    </head>
    
    <body onload="LoadText()">
    
    <div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="Text">
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text Click button >> <button onclick="LoadText()">Click Here</button></div>
    
    </body>
    
    </html>
    so what could be wrong lol code all ways fun when you get a problem lol

    Thanks

  9. #8
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script type="text/javascript" src="TypingText.js">
    /****************************************************
    * Typing Text script- By Twey @ Dynamic Drive Forums
    * Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
    * This notice MUST stay intact for legal use
    ****************************************************/
    </script>
    
    </head>
    
    <body>
    <div id="example1">Thanks for visiting <a href="http://www.dynamicdrive.com/">Dynamic Drive!</a>
    Wow, HTML gets properly typed out too!</div>
    
    <p id="example2">This text has a <b>slashing cursor</b> at the end. <br />And this is on a new line, thanks to the <br> tag.</p>
    <input type="button" name="" value="Run Text 2" onmouseup="TypingText.all[1].run()"/>
    <script type="text/javascript">
    //Define first typing example:
    new TypingText(document.getElementById("example1"));
    
    //Define second typing example (use "slashing" cursor at the end):
    new TypingText(document.getElementById("example2"), 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
     TypingText.all[0].run()
    
    //Type out examples:
    //TypingText.runAll();
    </script>
    
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  10. #9
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    tested and works:
    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Text And More Text And More Text</title>
    <script type="text/javascript" src="TypingText.js">
    /****************************************************
    * Typing Text script- By Twey @ Dynamic Drive Forums
    * Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
    * This notice MUST stay intact for legal use
    ****************************************************/
    </script>
    <script type="text/javascript">
    
    function LoadText(){
    new TypingText(document.getElementById("Text"), 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
    TypingText.runAll();
    }
    
    function DoText(){
    var thing = document.getElementById("thing");
    thing.style.visibility = 'visible';
    new TypingText(thing, 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
    TypingText.runAll();
    }
    </script>
    </head>
    
    <body onload="LoadText()">
    
    <div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="Text">
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text And More Text And More Text 
    	And More Text And More Text And More Text And More Text And More Text And 
    	More Text And More Text And More Text And More Text And More Text And More 
    	Text And More Text And More Text And More Text Click button >> </div><button onclick="DoText()">Click Here</button>
    <br />
    <br />
    <br />
    <br />
    <div id="thing" style="visibility:hidden;">
    fishfiasfunjaiweninfinafoijfwij
    </div>
    	
    </body>
    
    </html>
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  11. The Following User Says Thank You to bernie1227 For This Useful Post:

    Taz89 (09-21-2012)

  12. #10
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    TypingText.runAll(); runs all instances

    TypingText.all[0].run(); runs instance 0
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  13. The Following User Says Thank You to vwphillips For This Useful Post:

    Taz89 (09-21-2012)

Similar Threads

  1. Typing Text in IE7
    By fileserverdirect in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-20-2007, 11:01 PM
  2. Typing text
    By favorite_radio in forum Dynamic Drive scripts help
    Replies: 22
    Last Post: 04-25-2007, 08:29 AM
  3. Typing text
    By chechu in forum Dynamic Drive scripts help
    Replies: 8
    Last Post: 11-11-2006, 01:55 PM
  4. Typing text
    By chechu in forum HTML
    Replies: 4
    Last Post: 11-10-2006, 11:53 AM
  5. Paragraphs in Typing Text
    By Zarite Prime in forum Dynamic Drive scripts help
    Replies: 14
    Last Post: 03-18-2006, 05:14 PM

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
  •