Register Members List Search Today's Posts Mark Forums Read

Thread Tools
Old 29 Dec 2008, 16:02
Triky's Avatar
Triky Triky is offline
Join Date: Mar 2007
Location: [Italy]
How do I change the .body background color with Javascript?

As per title. I would like to add an option to let users change the style's .body background color in their usercp. And it should be saved in their options, so they see that color until they change it again.
I'm italian, I am learning english.. so, please, if you see any errors in my grammar or spelling, let me know via PM. Danke!
Reply With Quote
Old 29 Dec 2008, 16:20
UKBusinessLive UKBusinessLive is offline
Join Date: Sep 2008
Real name: Gerry

i've been looking at something like this myself, here is a very basic example

1st you need to save this code as a Javascript so copy it to your notepad and save it as "Backcolor.js"

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

then you upload the backcolor.js file to same directory as the Web page on which you will use the script (ideally your Forum Root)

Then enter the code below, between the <body> and </body> tags where you want the select box and button to appear, ideally in the footer or header templates

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

What that will do is give your users a dropdown box with a Change Color button ( for the english spelling please change the above code here <input type="submit" value="Change Color" />

i've done this very basic, but you can change the colors in the backcolor.js file just change the case 1, 2 and 3 options with a new hex color #FFFFFF

You can get a nice selection of hexcolors here

This is what you get, Mind you it won't work well on my forum as its fluid, but it'll work well with fixed forums

Remember you can change these colors, I've just done 3 as an example, But you can add as many as you want and with millions of combinations by using a color Hex chart.

Have Fun

To see the new template edit in the mods forum

Last edited by UKBusinessLive; 29 Dec 2008 at 17:36. Reason: Auto-Merged DoublePost
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Thread Enhancements Sticky background color change Chris-777 vBulletin 3.7 Template Modifications 53 05 May 2011 02:46

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

New To Site? Need Help?

All times are GMT. The time now is 18:40.

Layout Options | Width: Wide Color: