Results 1 to 13 of 13

Thread: Background colour

  1. #1
    Join Date
    Nov 2011

    Background colour

    I want to rebuild a website, and I want to have a button that gives people the option of three background color choices. How can I do that?

  2. #2
    Join Date
    Nov 2002
    JavaScript or PHP can do it.

  3. #3
    Join Date
    Feb 2012
    you can do it using javascript easily, give id to body like this

    <body id="changecolor">

    then handle id using

    hope it will helpfull to you...get me back if any query....

  4. #4
    Join Date
    Mar 2012
    thanks for this code dude...

  5. #5
    Join Date
    Nov 2011
    You can use javascript:
    you can add multiple classes to an element by giving a space in between classnames like this
    <body class="blue red green">
     some html. . .
    and add an onclick event handler to each button like:
    <input type="button" value="change to blue" onclick="blue_bg()">
    if for e.g the "change to blue" button is clicked, the blue_bg function is called, the blue class is added and the 2 other classes are removed and background is changed to blue (JQuery can b handy if u wish to use it).
    COOKIES can be used to remember the user if you wish.
    Last edited by ibixxon; 03-10-2012 at 08:46 AM.

  6. #6
    Join Date
    Nov 2011
    Thank you everyone. What I'm trying to do is rebuild a site that is very hard to update because of the three different background colors. I have to update one page in one folder then copy it to two other folders and change the css path. You will see what I mean when looking at this site. Keep in mind, I did not build this site. I just took over it.


  7. #7
    Join Date
    Nov 2011
    Then start building.. If you have any dificulties feel free 2 query.

  8. #8
    Join Date
    Nov 2011
    Is there away I can extract the javascript from the site. I understand css, so thats not a problem, but javascript I'm still learning.


  9. #9
    Join Date
    Nov 2011
    Are you trying to remove javascript from the site entirely ? Or from a portion of a page ?

    If you want to remove javascript entirely you might have a problem, that is If JS is used to generate some part of the page/site.
    But then it will be easier to remove, if JS is saperated from main content.
    If you want to remove javascript from a portion of a page, it probably have been linked or written in the page, so its either you locate and delete it or remove the link to the JS file.
    If i didn't ans. your question, its probably bcos i didn't understand it. You can help by making it clear.

  10. #10
    Join Date
    Nov 2011
    I started rebuilding by taking the first page and starting from there. I don't want to use all the javascript just parts of it. For example trying to figure how they got the rollover affect to some buttons.

  11. #11
    Join Date
    Mar 2012
    Quote Originally Posted by Maxxxx View Post
    I have to update one page in one folder then copy it to two other folders and change the css path. You will see what I mean when looking at this site aacwinnipeg.mb.ca
    Your problem is that the home page seems to have the file extension ".html". HTML is clumsy because it does not have any variables. So, to change the background color, you have to have three versions of EVERY html pages. That's the way it is.

    You can avoid having to copy the html files by using php. However:

    1. You need to be familiar with the basics of passing variables in php! if not, then I suggest that you have two choices:

    a) if you are being paid to maintain the site, you could point out that the color facility is cumbersome and costly in your time. If they say "so what?", just shrug and get on with it.

    b) if you are maintaining the site voluntarily, I would make taking it on conditional on removing the facility! It really is not worth the hassle.

    2. Otherwise, the web pages need to have the fie extension ".php" instead of ".html" to support variables. This can be a problem on the home page, So what you can do as a compromise is:

    a) Locate the three versions of the home page (and their css files) in the same directory. Fortunately they already have different names: index.html, inv.html and hc.html.

    b) Rename the rest of one version of the web pages ".php" instead of ".html".

    c) Amend the anchors linking the web pages to simulate a GET form submission. I'm not sure whether this is documented. It's a trick I worked out for myself when rebuilding an old site like you are doing. However, it is a little complicated to put here. If you are interested I can document it.

    P.S. If the javascript is working, why remove it?
    Last edited by jedaisoul; 03-10-2012 at 01:06 PM.

  12. #12
    Join Date
    Nov 2011
    I'll have to think over my options. i just want to avoid doing everything three times. i'll get back to you.

  13. #13
    Join Date
    Nov 2011
    How cn I ad my own image to this code?

    <input type="button"
     value="White bg, black text"
     onClick="document.bgColor = '#FFFFFF';document.fgColor='#000000';">
    better yet. If I could add the three images i have in the code below. would help me alot in rebuilding a page.

    <div id="page"> <h2><strong>Page Style</strong></h2> <ul><li id="default"><a href="index.html"><h5>Standard</h5></a></li> <li id="WB"><a href="inv/inv.html"><h5>Inverted</h5></a></li> <li id="bw"><a href="hc/hc.html"><h5>High Contrast</h5></a></li>
    Last edited by Maxxxx; 03-10-2012 at 07:21 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11623 seconds
  • Memory Usage 2,974KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (13)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (13)postbit
  • (13)postbit_onlinestatus
  • (13)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates