Hellusius Posted July 30, 2006 Share Posted July 30, 2006 I try to modify the background color when the usser clicks on a radiobutton, frankly nothing happens so far.[code]<form><br><input type="radio" name="bgcolor" onClick="document.bgcolor= class="Normal" checked>Normal</a><br><input type="radio" name="bgcolor" onClick="document.bgcolor= class="Light">Light</a><br><input type="radio" name="bgcolor" onClick="document.bgcolor= class="Dark">Dark</a><br></form>[/code]I put in the little CSS code which looks like this[code]<style type="text/css">.dark {background-color: #335588};.Light {background-color: #7799CC};.Normal {background-color: #5577AA};</style>[/code]ant suggestion why it doesn't work, cause I have seen it been done before Quote Link to comment Share on other sites More sharing options...
Hellusius Posted July 30, 2006 Author Share Posted July 30, 2006 The link in which they gave an example can be found [url=http://"http://www.javascriptkit.com/javatutors/event2.shtml"]here[/url] Quote Link to comment Share on other sites More sharing options...
Zane Posted July 30, 2006 Share Posted July 30, 2006 if you're going to use CSS, there's no use direct linking to the document.bgcolor propertyjust use the onClick to set the body class respectively[code]<input type="radio" name="bgcolor" onClick="document.body.class="dark">[/code] Quote Link to comment Share on other sites More sharing options...
Hellusius Posted July 30, 2006 Author Share Posted July 30, 2006 The akward thing is, that it does not change my background of the page ??? Quote Link to comment Share on other sites More sharing options...
Hellusius Posted July 30, 2006 Author Share Posted July 30, 2006 I got it working now with the following code[code]<input type="radio" name="bgcolor" onClick="document.bgColor='5577AA'">Normal</a><br><input type="radio" name="bgcolor" onClick="document.bgColor='7799DD'">Light</a><br><input type="radio" name="bgcolor" onClick="document.bgColor='335588'">Dark</a><br>[/code]But now would I like to save it so it keeps having that background through all pages as well, is that a possiblity? Quote Link to comment Share on other sites More sharing options...
Hellusius Posted August 3, 2006 Author Share Posted August 3, 2006 I am still wondering how I can save the background color the visitor picked, is there a way? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 4, 2006 Share Posted August 4, 2006 use a cookie.http://www.w3schools.com/js/js_cookies.asp 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.