Tezza` Posted September 9, 2008 Share Posted September 9, 2008 Just something a little simple.... Simpley place in the body tags. <form> <input type="button" value="White" onClick="document.bgColor = '#FFFFFF';"> <input type="button" value="Green" onClick="document.bgColor = '#008000';"> <input type="button" value="Blue" onClick="document.bgColor = '#0000FF';"> <input type="button" value="Red" onClick="document.bgColor = '#FF0000';"> <input type="button" value="Grey" onClick="document.bgColor = '#999999';"> <input type="button" value="Black" onClick="document.bgColor = '#000000';"> </form> It will look like this... and each color you click will change the background color. Enjoy :) Quote Link to comment Share on other sites More sharing options...
Joel Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. Very nice tezza Quote Link to comment Share on other sites More sharing options...
POG1 Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. this should be in the JavaScript section. Quote Link to comment Share on other sites More sharing options...
Tezza` Posted September 9, 2008 Author Share Posted September 9, 2008 Re: Changing background color. It should :/? Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. Its html mixed with javascript. I think Quote Link to comment Share on other sites More sharing options...
POG1 Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. onClick="document.bgColor = '#0000FF';" That is JS. It's changing the DOM which HTML alone can't do. Quote Link to comment Share on other sites More sharing options...
-Matt- Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. if i'm correct there is missing parts of the codes. Quote Link to comment Share on other sites More sharing options...
Tezza` Posted September 9, 2008 Author Share Posted September 9, 2008 Re: Changing background color. Prolly the bit that stores it, i didnt know how to do that.... So once you change the page it will go back to default. Quote Link to comment Share on other sites More sharing options...
POG1 Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. you will need to set a cookie and have a window.onload event to check the colour.. Quote Link to comment Share on other sites More sharing options...
Tezza` Posted September 9, 2008 Author Share Posted September 9, 2008 Re: Changing background color. i thought it was a cookie but im unsure of how to add it. Quote Link to comment Share on other sites More sharing options...
Nickson Posted September 9, 2008 Share Posted September 9, 2008 Re: Changing background color. Well it all depends on what you want to do with it ... Tezza just said it changes the background, not that it would store the current background for a later re-vist. you should read what people say. It's not because they say it changes the background it would also store it and disable the button for that color... Quote Link to comment Share on other sites More sharing options...
Floydian Posted September 10, 2008 Share Posted September 10, 2008 Re: Changing background color. lol @ Templar Are you a lawyer? hehe I can't argue with your logic though ;) Quote Link to comment Share on other sites More sharing options...
Nickson Posted September 10, 2008 Share Posted September 10, 2008 Re: Changing background color. No I'm not, however I don't like that people are always complaining. Not that It will ever change, but anyways I try to do something about it. If people read and understand what is posted, they can and should expect that the code works and does what the topic starter says. If (s)he does not mention anything about something else, then it probably isn't there. He did not say anything about storing the current background for later purposes, then why would one expect it? If I read something that does not include storage, I don't expect it either ... Optimism is good though, but way to many people on here want to get spoiled with all kinds of stuff. Just look at this thread, it's like so many others, Matt says it's missing parts of the codes, but as far as I know tezza gave all code that is needed for this. Matt is expecting too much and didn't read what tezza's intentions were with posting this partial code. (No offense to matt or anything, it just happens to be a good example :p) It isn't hard, I think ... or is it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.