PDA

View Full Version : Swapping the document.bgColor


becool0130
10-06-2006, 11:08 PM
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

_Aerospace_Eng_
10-06-2006, 11:28 PM
And the reason for starting a new thread about this when you already had one open was? http://www.codingforums.com/showthread.php?t=97845
Don't waste our time.