Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy How to Change the color and length of scolling script

    Hi all,

    I have a free script I have downloaded and I can't figure out how to edit it so that I can change the color of the text to whatever I want it to be and also so that the length of the scrolling text (I am not sure if scrolling is the right term) can be changed.

    For some reason the text does not go all the way to the end of the page on the right it stops quite a way before.

    Here is the code:

    Code:
    <script language="JavaScript1.2">
    <!--
    
    /*
    Typing Scroller
    For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
    */
    
    //Secify scroller contents
    var line=new Array()
    line[1]="Testing testing one to three and you can test some more."
    line[2]="Always testing always testing"
    line[3]="Trying to test some more and some more again"
    line[4]="second to last bit of testing."
    line[5]="Testing text that is just testing one more time"
    
    //Specify font size for scoller
    var ts_fontsize="13px"
    
    //--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: arial; 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>

    I have been trying to figure this out for about 2 hours but since I am a 100% novice with javascript I have not got very far.

    Any help would be gratefully recieved.

  • #2
    Regular Coder
    Join Date
    Nov 2009
    Posts
    247
    Thanks
    4
    Thanked 22 Times in 22 Posts
    javanovice2:

    Any "script" which uses document.write is long obsolete.

    Try this, instead:

    http://www.dynamicdrive.com/forums/s...ad.php?t=49532

  • Users who have thanked Sciliano for this post:

    javanovice2 (12-18-2010)

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    As sciliano says, this is long-obsolete code.

    <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
    The <!-- and //--> comment (hiding) tags have not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that (as here) you are looking at ancient and perhaps unreliable code.

  • Users who have thanked Philip M for this post:

    javanovice2 (12-18-2010)

  • #4
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Sciliano View Post
    javanovice2:

    Any "script" which uses document.write is long obsolete.

    Try this, instead:

    http://www.dynamicdrive.com/forums/s...ad.php?t=49532
    Quote Originally Posted by Philip M View Post
    As sciliano says, this is long-obsolete code.

    <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
    The <!-- and //--> comment (hiding) tags have not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that (as here) you are looking at ancient and perhaps unreliable code.
    Thanks to the both of you.

    I have learned something today. I am not longer a novice I am now one up from a novice.

    I will take a look at the link suggested.

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Sciliano View Post
    javanovice2:

    Any "script" which uses document.write is long obsolete.

    Try this, instead:

    http://www.dynamicdrive.com/forums/s...ad.php?t=49532
    I tried that script and I couldn't get the text to show up on the crawler for some reason so I actually bought I bunch of scripts from the site hoping to get one that works and I still can't get the script to show up.

    I have a feeling it might be because the code is out of date or not compatible with my doc type, and needs to be tweaked a bit.

    It also shows different results in IE than it does in Firefox.

    Help...

    As my username suggests I am a total novice and I am trying to learn this stuff but for now I just need a working script or two to get me going.

    Any advice would be greatfully recieved.
    Last edited by javanovice2; 12-29-2010 at 09:03 PM.

  • #6
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I still haven't found the answer to this one. I have emailed the developer and am awaiting a reply.

    I will be doing some more research myself, but I suspect it is a very simple fix for anyone that is an expert.

  • #7
    Regular Coder
    Join Date
    Nov 2009
    Posts
    247
    Thanks
    4
    Thanked 22 Times in 22 Posts
    I inserted the crawler in to your page and fixed several errors in your markup. You need to validate both the markup and css, here:

    http://validator.w3.org/

    http://jigsaw.w3.org/css-validator/

    You shouldn't use tables for page layout. Use CSS.

    Your document is an example to others of everything to avoid. It uses the worst of the worst practices. I'd scrap it and start anew.
    Attached Files Attached Files
    Last edited by Sciliano; 12-29-2010 at 12:29 PM.

  • Users who have thanked Sciliano for this post:

    javanovice2 (12-29-2010)

  • #8
    Regular Coder
    Join Date
    Dec 2010
    Location
    Sheffield, UK
    Posts
    138
    Thanks
    81
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Sciliano View Post
    javanovice2:

    Any "script" which uses document.write is long obsolete.

    Try this, instead:

    http://www.dynamicdrive.com/forums/s...ad.php?t=49532
    By obsolete, I assume you mean it's no longer in use? So, if I used document.write in a script, it wouldn't work at all?

  • #9
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Sciliano View Post
    Your document is an example to others of everything to avoid. It uses the worst of the worst practices. I'd scrap it and start anew.
    Strong words. I feel like a naughty school child.

    I really appreciate your frankness and the fact that you say it like it is.

    The truth is I am a novice trying to do things on a shoe string budget and I tried using css but I just couldn't get things to look right. However, I will look at it again and try to scrape the tables.

    Saying it's an an example of EVERYTHING to avoid, I think was a bit over the top, but point taken. I much rather you talk to me straight as you have and help, as you have, rather than not get involved.

    Thanks, I really appreciate it and I will implement what you have attached.

    I can't thank you enough for helping me out. I have been at this for hours and it has been driving me crazy.

    Cheers
    Last edited by javanovice2; 12-29-2010 at 03:40 PM.


  •  

    Posting Permissions

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