Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Internet Explorer Changing background color of disabled fields in IE6

    This is the page in question: http://www.supernovapatents.com/searchform.php

    I'm having a devil of a time trying to make it so that my input fields gray out in IE6. Everything works fine in Firefox. I've tried using javascript to dynamically insert a class="disabled" in the input elements, then tried to style it in CSS to no avail.

    My stylesheet can be found here:

    http://www.supernovapatents.com/web.css

    The stylesheet is a convoluted mess, I am sorry. The search form section begins on line 173. I've experimented with a number of things to try to get it to work.The last thing I tried to do was this:

    .disabled
    {
    background-color: gray;
    }

    Basically, I want to make it so that when a user clicks "paypal" all the billing fields below gray out, and when a user clicks "same address" all the address fields below gray out. The relevant javascript is in the header of searchform.php.

    For some reason the "same address" checkbox grays out appropriately in ie6, but none of the other fields do. I have no idea why this is. Any help would definitely be appreciated.

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Location
    Raleigh, NC
    Posts
    273
    Thanks
    7
    Thanked 59 Times in 52 Posts
    IE actually interprets "setAttribute" to work on the javascript object iteself, and that makes things unpredictable. That's why you can't use things like object.class or object.for in IE (because it's a collision with the javascript reserved word).

    Instead use:

    Code:
    el.className = 'disabled';
    which although is technically IE's way of getting around its own reserved word collision it also works in mozilla as well. If you'd rather conditionally only use "className" for IE, you could use this as well:

    Code:
    el.setAttribute((document.all ? ‘className’ : ‘class’), 'disabled');
    Last edited by vtjustinb; 10-17-2007 at 04:20 PM.

  • Users who have thanked vtjustinb for this post:

    jconaway (10-17-2007)

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Location
    Raleigh, NC
    Posts
    273
    Thanks
    7
    Thanked 59 Times in 52 Posts
    Bah. No way to delete a double-post FTL.
    Last edited by vtjustinb; 10-17-2007 at 04:20 PM.

  • #4
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    yes!

    That worked perfectly. Thank you so much.


  •  

    Posting Permissions

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