Background colour change.

This is a discussion on "Background colour change." within the JavaScript Forum section. This forum, and the thread "Background colour change. are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 4th, 2008, 14:44
Junior Member
Join Date: Jan 2008
Location: The other side of your monitor
Age: 19
Posts: 29
Blog Entries: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Post Background colour change.

I've seen some JS that you can use with radio buttons to make your background colour of your website change, but forgot the JS for it.

Anyone know it? thanks.
Last Blog Entry: Disaster! (Aug 23rd, 2008)
Reply With Quote

  #2 (permalink)  
Old Jun 4th, 2008, 14:47
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Background colour change.

It would be easy to give your body tag an ID....

<body id="body">

Then just use an onclick event to change the bgcolor.

document.getElementById("body").style.bgcolor = "#ff0000";

Not 100% sure if it's bgcolor or background or background color, but just experiment

There are ways to do it without an id, but having never needed to do this thats all I can contribute at this time.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #3 (permalink)  
Old Jun 4th, 2008, 14:56
Junior Member
Join Date: Jan 2008
Location: The other side of your monitor
Age: 19
Posts: 29
Blog Entries: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Background colour change.

Thanks Rob. I fount the JS for on the website i looked on (on the college I attend's server) and its written out like this:

Code: Select all
  <table width="147" align="center">
      <tr>
        <td><label>
          <INPUT type="radio" name="radio1" onClick="document.bgColor='2E4C6B'">
   <font face="Courier">Dark Blue</font></label></td>
        </tr>
      <tr>
        <td><label>
          <INPUT type="radio" name="radio1" onClick="document.bgColor='B3CCE6'"> 
   <font face="Courier">Light Blue</font></label></td>
        </tr>
      <tr>
        <td><label>
          <INPUT type="radio" name="radio1" onClick="document.bgColor='FFFFFF'"> 
   <font face="Courier">White</font></label></td>
        </tr>
     </table>
Once again, thanks for your help.
Last Blog Entry: Disaster! (Aug 23rd, 2008)
Reply With Quote
  #4 (permalink)  
Old Jun 4th, 2008, 15:06
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Background colour change.



Glad you found what you needed!
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #5 (permalink)  
Old Jun 6th, 2008, 12:16
Junior Member
Join Date: Jan 2008
Location: The other side of your monitor
Age: 19
Posts: 29
Blog Entries: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Background colour change.

Thanks Rob. More JS that I have learned!
Last Blog Entry: Disaster! (Aug 23rd, 2008)
Reply With Quote
Reply

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Background colour based on input smudge618 JavaScript Forum 2 Feb 6th, 2008 11:55
how do you make it so the user can change the font colour and size and background... VanHype JavaScript Forum 2 Apr 24th, 2007 16:39
Help needed for newbie! How can I change the background colour on my website? angelkelly Starting Out 15 Feb 20th, 2007 22:28
Colour change Angel2020 Web Page Design 4 Nov 17th, 2006 11:23
Is there a way to change the colour scheme? gwx03 Webforumz Suggestions and Feedback 14 Jan 6th, 2006 18:00


All times are GMT. The time now is 19:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43