Results 1 to 3 of 3

Thread: Please help with some javascript code

  1. #1
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help with some javascript code

    alright i found this code on this site dynamic drive as you can see in the comments of the javascript but i want it to start making lines of it not deleting the old ones it would finish a line delete then start the other but i want it to finish the line then go to the next line on the page here is the code <script language="JavaScript1.2">
    <!--

    /*
    Typing Scroller
    Submitted by bengaliboy00@hotmail.com (hp: http://www.angelfire.com/nt/bengaliboy/)
    With modifications by Dynamicdrive.com
    For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
    */

    //Secify scroller contents
    var line=new Array()
    line[1]="This is an awsome script"
    line[2]="It brings up the text you want..."
    line[3]="One letter at a time"
    line[4]="You can add and subtract lines as you like."
    line[5]="It\'s very cool and easy to use"

    //Specify font size for scoller
    var ts_fontsize="16px"

    //--Don't edit below this line

    var longestmessage=1
    for (i=2;i<line.length;i++){
    if (line[i].length>line[longestmessage].length)
    longestmessage=i
    }

    //Auto set scroller width
    var tscroller_width=line[longestmessage].length

    lines=line.length-1 //--Number of lines

    //if IE 4+ or NS6
    if (document.all||document.getElementById){
    document.write('<form name="bannerform">')
    document.write('<input type="text" name="banner" size="'+tscroller_width+'"')
    document.write(' style="background-color: '+document.bgColor+'; color: '+document.body.text+'; font-family: verdana; font-size: '+ts_fontsize+'; font-weight:bold; border: medium none" onfocus="blur()">')
    document.write('</form>')
    }

    temp=""
    nextchar=-1;
    nextline=1;
    cursor="\\"
    function animate(){
    if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
    nextline++;
    nextchar=-1;
    document.bannerform.banner.value=temp;
    temp="";
    setTimeout("nextstep()",1000)}
    else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
    nextline=1;
    nextchar=-1;
    document.bannerform.banner.value=temp;
    temp="";
    setTimeout("nextstep()",1000)}
    else{
    nextstep()}}

    function nextstep(){

    if (cursor=="\\"){
    cursor="|"}
    else if (cursor=="|"){
    cursor="/"}
    else if (cursor=="/"){
    cursor="-"}
    else if (cursor=="-"){
    cursor="\\"}


    nextchar++;
    temp+=line[nextline].charAt(nextchar);
    document.bannerform.banner.value=temp+cursor
    setTimeout("animate()",25)}

    //if IE 4+ or NS6
    if (document.all||document.getElementById)
    window.onload=animate
    // -->
    </script>




    can anyone help please?

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.


    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure that you have included all relevant code and/or a link to the page in question.
    You might also consider making a reduced test case using an online tool like jsfiddle


    Please use the forum's bbcode tags and indent your code to make it more readable:

    for php code............[php] <?php /* code goes here */ ?> [/php]
    for html...............[html] <!-- markup goes here -->.....[/html]
    for js/css/other.......[code] code goes here................[/code]

    results in:
    PHP Code:
     <?php /* code goes here */ ?>
    HTML Code:
     <!-- markup goes here -->
    Code:
     code goes here

  3. #3
    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>
    </head>
    
    <body>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    /*
    Typing Scroller
    Submitted by bengaliboy00@hotmail.com (hp: http://www.angelfire.com/nt/bengaliboy/)
    With modifications by Dynamicdrive.com
    For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
    */
    
    //Secify scroller contents
    var line=new Array()
    line[1]="This is an awsome script"
    line[2]="It brings up the text you want..."
    line[3]="One letter at a time"
    line[4]="You can add and subtract lines as you like."
    line[5]="It\'s very cool and easy to use"
    
    //Specify font size for scoller
    var ts_fontsize="16px"
    
    //--Don't edit below this line
    
    var longestmessage=1
    for (i=2;i<line.length;i++){
    if (line[i].length>line[longestmessage].length)
    longestmessage=i
    }
    
    //Auto set scroller width
    var tscroller_width=line[longestmessage].length
    
    lines=line.length-1 //--Number of lines
    
    //if IE 4+ or NS6
    if (document.all||document.getElementById){
    document.write('<form name="bannerform">')
     for (var z0=1;z0<line.length;z0++){
      document.write('<input type="text" name="banner" size="'+tscroller_width+'"')
      document.write(' style="background-color: '+document.bgColor+'; color: '+document.body.text+'; font-family: verdana; font-size: '+ts_fontsize+'; font-weight:bold; border: medium none" onfocus="blur()"><br>')
     }
    document.write('</form>')
    }
    
    temp=""
    nextchar=-1;
    nextline=1;
    cursor="\\"
    
    function animate(){
     if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
      nextline++;
      nextchar=-1;
      document.bannerform.banner[nextline-1].value='';
      temp="";
      setTimeout("nextstep()",1000)
     }
     else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
      nextline=1;
      nextchar=-1;
      for (var z0=0;z0<line.length-1;z0++){
      document.bannerform.banner[z0].value='';
      }
      temp="";
      setTimeout("nextstep()",1000)
     }
      else{
      nextstep()
     }
    }
    
    function nextstep(){
    
    if (cursor=="\\"){
    cursor="|"}
    else if (cursor=="|"){
    cursor="/"}
    else if (cursor=="/"){
    cursor="-"}
    else if (cursor=="-"){
    cursor="\\"}
    
    
    nextchar++;
    temp+=line[nextline].charAt(nextchar);
      document.bannerform.banner[nextline-1].value=temp+cursor;
    setTimeout("animate()",25)}
    
    //if IE 4+ or NS6
    if (document.all||document.getElementById)
    window.onload=animate
    // -->
    </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/

Similar Threads

  1. Help in JavaScript with VB Dot Net Code
    By justinemathew in forum JavaScript
    Replies: 0
    Last Post: 12-27-2012, 11:44 AM
  2. Javascript and php code for autocalculation
    By rhodarose in forum JavaScript
    Replies: 1
    Last Post: 10-17-2011, 05:40 AM
  3. Javascript code that needs a little help
    By reddiestorm in forum JavaScript
    Replies: 2
    Last Post: 02-08-2009, 06:03 PM
  4. Replies: 2
    Last Post: 10-27-2008, 05:16 AM
  5. Problem with JavaScript Code - HELP!!!
    By magicyte in forum JavaScript
    Replies: 8
    Last Post: 07-05-2008, 08:45 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
  •