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 7 of 7

Thread: bgcollor change

  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts

    bgcollor change

    I need help in making a function that changes the collor that is stored in a array where each slot is either 0-9 or A-F and it will compine them to make the collor thingy. But i want it when it is done increase the last one by 1 and update all the rest. so that the collor stays the same if someone can post a sample script for me to work from will be fine

  • #2
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i dont really get what u mean...

  • #3
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is that even english?
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #4
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i want to make a script that changes the back ground collor from white to black and every collor inbetween. So in the end the first collor it changes it to is #000000 and than goes to #FFFFFF and after that goes back to white. so somehow it should do something like this
    #000000
    #000001
    #000002
    #000003
    etc.
    But once it gets to #FFFFFF it sets it back down to #000000. Does that help?

  • #5
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts
    and i do believe i have been spelling collor wrong but not sure

  • #6
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,680
    Thanks
    0
    Thanked 230 Times in 225 Posts
    Hi there Kura_kai,

    try this, it may give you some ideas...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>background color change</title>
    
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
    <meta name="Content-Script-Type" content="text/javascript"/>
    <meta name="Content-Style-Type" content="text/css"/>
    <style type="text/css">
    /*<![CDATA[*/
    
    body {
         background-color:#999;
     }
    #foo {
         width:324px;
         height:200px;
         border:6px inset #999;
         margin:50px auto;
    }
    
    /*//]]>*/
    </style>
    
    <script type="text/javascript">
    //<![CDATA[
    
      var i=0;
      var j=0;
      var k=0;
    
    function stuffup() {
         document.getElementById('foo').style.backgroundColor='rgb('+i+','+k+','+j+')';
       i++;
    if(i>=255) {
       j++;
     }
    if(j>=255) {
       k++;
     }
    if(k==255) {
       i=255;
       j=255;
    clearTimeout(up);
    stuffdown();
    return;
     }
    up=setTimeout('stuffup()',20);
     }
    
    function stuffdown() {
         document.getElementById('foo').style.backgroundColor='rgb('+i+','+k+','+j+')';
       k--;
    if(k<=0) {
       j--;
     }
    if(j<=0) {
       i--;
     }
    if(i==0) {
       j=0;
       k=0;
    clearTimeout(down);
    stuffup();
    return;
     }
    down=setTimeout('stuffdown()',20);
     }
    onload=stuffup;
    
    //]]>
    </script>
    
    </head>
    <body>
    
    <div id="foo"></div>
    
    </body>
    </html>
    
    coothead

  • #7
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That code is very nice but unfortunatly i don't know how it works and trying to decipher it also...any help with that?


  •  

    Posting Permissions

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