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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    back to base color

    hi there,

    I have some javascript from http://www.dynamicdrive.com to do the neonlight text effect. Originally it's non-stop effect, but I changed it to just flash once. But the problem now is the last four letters will stay as the neontext color. How to change the color of last letters back to basecolor after the effect?

    thanks very much!
    Code:
    <script language="JavaScript1.2">
    
    var message="my message goes here blah blah blah"
    var neonbasecolor="#C6AEC7"
    var neontextcolor="#FDD017"
    var neontextcolor2="#D4A017"
    var flashspeed=100   // speed of flashing in milliseconds
    var flashingletters=4  // number of letters flashing in neontextcolor
    var flashingletters2=1  // number of letters flashing in neontextcolor2 (0 to disable)
    var flashpause=200   // the pause between flash-cycles in milliseconds
    ///No need to edit below this line/////
    
    var n=0
    if (document.all||document.getElementById){
    document.write('<font color="'+neonbasecolor+'">')
    for (m=0;m<message.length;m++)
    document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>')
    document.write('</font>')
    }
    else
    document.write(message)
    
    function crossref(number){
    var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number)
    return crossobj
    }
    
    function neon(){
    
    //Change all letters to base color
    if (n==0){
    for (m=0;m<message.length;m++)
    crossref(m).style.color=neonbasecolor
    }
    
    //cycle through and change individual letters to neon color
    crossref(n).style.color=neontextcolor
    
    if (n>flashingletters-1) crossref(n-flashingletters).style.color=neontextcolor2 
    if (n>(flashingletters+flashingletters2)-1) crossref(n-flashingletters-flashingletters2).style.color=neonbasecolor
    
    
    if (n<message.length-1)
    n++
    else{
    n=0
    clearInterval(flashing)
    return
    }
    }
    
    
    function beginneon(){
    if (document.all||document.getElementById)
    flashing=setInterval("neon()",flashspeed)
    }
    
    beginneon()
    </script>

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi!
    How about:

    var endcolor = "#ff0000";

    function callMeAtEnd () {
    var m = 0;
    for (m=0;m<message.length;m++)
    document.getElementById('neonlight'+m).style.color = endcolor;
    }

    Greetings
    Dieter
    ---

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks DH2006

    i tried your method, but didn't work.

    i also tried:
    Code:
    beginneon()
    
    var endcolor = "red";
    function callMeAtEnd () {
    document.getElementById(message).style.color = endcolor;
    }
    callMeAtEnd()
    the text color didn't change to red.

    any suggestions please


  •  

    Posting Permissions

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