Web Analytics Made Easy -
StatCounter Swap the document.bgColor - CodingForum

Announcement

Collapse
No announcement yet.

Swap the document.bgColor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Swap the document.bgColor

    Hey everyone,
    Any help would be greatly appreciated!! :] Heres what I want to accomplish:

    -Create a button

    -Swap color when
    clicked it will
    swap background
    color with a user
    chosen color and
    the original color

    -Prompt for background
    choice

    -Each time the button is
    clicked, the background
    color is exchanged
    between the original and
    user's choice.

    The following code is where I'm currently at:

    <html>
    <head>
    <title>Your Color!!!</title>
    <script language=javascript>
    var color;
    var color1=white
    function changecolor(){
    color=prompt("To what color do you wish for the scheme of this page to be?")
    document.bgColor=color;
    document.bgColor=white;
    };
    </script>
    <form>
    <input type="button" value="Change Color" onClick="changecolor()">
    </form>
    </head>
    </html>

    Im lost and I need your help please.

    Thanks a bunch,
    Tim
    Last edited by becool0130; Oct 7, 2006, 01:07 AM.

  • #2
    And the code you are using looks like? Oh wait I guess we are supposed to be psychic or something.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

    Comment


    • #3
      wow, becool0130, you do not know the basis of HTML. You have inserted the form into the head of the document and your document has no body... Before learning javascript learn HTML.
      KOR
      Offshore programming
      -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

      Comment

      Working...
      X