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 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Background color/ Text Color - JavaScript, need help ASAP

    Background color/ Text Color - JavaScript, need help ASAP

    --------------------------------------------------------------------------------

    need help with this script... Big time, I like that it allows webpage viewers to change both the text color and the background color. But I need to allow the viewer to set the colors, like create a cookie or something. At the same time, be able to change the color of the background without changing the color of the text. This script does both at the same time, it's hard on the eyes. I need to allow viewers to change the background text and set it and then change the text color and set that too.

    <SCRIPT language=JavaScript>

    lck=0;

    function r(hval)
    {
    if ( lck == 0 )
    {
    document.bgColor=hval;
    document.fgColor=hval;
    document.f.c.value=hval;
    }
    }

    function l()
    {
    if (lck == 0)
    {
    lck = 1;

    }
    else
    {
    lck = 0;

    }
    }


    </SCRIPT>


    <BODY bgColor=#ffffcc>
    <P>
    <CENTER>
    <P>
    <TABLE border=0>
    <TBODY>
    <TR>
    <TD bgColor=#000000><A onmouseover="r('#000000'); return true"
    href="javascript:l()"><IMG height=10 src="" width=10 border=0></A></TD>
    <TD bgColor=#000033><A onmouseover="r('#000033'); return true"
    href="javascript:l()"><IMG height=10 src="" width=10 border=0></A></TD>
    <TD bgColor=#000066><A onmouseover="r('#000066'); return true"
    href="javascript:l()"><IMG height=10 src="" width=10 border=0></A></TD>
    <TD bgColor=#ffffff><A onmouseover="r('#ffffff'); return true"
    href="javascript:l()"><IMG height=10 src="" width=10
    border=0></A></TD></TR></TBODY></TABLE>
    <P>
    <FORM name=f><INPUT size=7 name=c> </FORM>
    <p><font size="7"></font></p>

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Funny thing...

    this came back false:
    Code:
    return /please|could you|any chance|i would be grateful|thanks/gi.test(http://www.codingforums.com/showthread.php?t=62786);
    Last edited by martin_narg; 07-05-2005 at 03:32 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    False? What do you mean?

    False? What do you mean?


  •  

    Posting Permissions

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