Getting default colour for <input> - or just the old colour

J

jodleren

Hi

During a radio selection I do this to grey out a disabled item - the
point is that the user can enable it again, and then I'd like to
restore the old colour, or just default colour of input items. The
point is, that the end user can set up colour of his/hers system, and
I'd like to use that

1) can I read the present colour?
2) can I get the system colour for that?

WBR
Sonnich

form1 = document.forms[0];
form1.dir1.disabled=!form1.opendir3.checked;
if(!form1.dir1.disabled)
{
form1.btn_dir1.focus();
form1.dir1.style.background=oldcolor;
}
else
form1.dir1.style.background="#f0f0f0";
 
D

David Mark

Hi

During a radio selection I do this to grey out a disabled item - the
point is that the user can enable it again, and then I'd like to
restore the old colour, or just default colour of input items. The
point is, that the end user can set up colour of his/hers system, and
I'd like to use that

1) can I read the present colour?
2) can I get the system colour for that?

WBR
Sonnich

    form1 = document.forms[0];
    form1.dir1.disabled=!form1.opendir3.checked;
    if(!form1.dir1.disabled)
    {
      form1.btn_dir1.focus();
      form1.dir1.style.background=oldcolor;
    }
    else
      form1.dir1.style.background="#f0f0f0";

Add a class when it is disabled and remove it when enabled.
 
T

Thomas 'PointedEars' Lahn

jodleren said:
During a radio selection I do this to grey out a disabled item - the
point is that the user can enable it again, and then I'd like to
restore the old colour, or just default colour of input items. The
point is, that the end user can set up colour of his/hers system, and
I'd like to use that

1) can I read the present colour?

Maybe. You can get the color from the computed style of the element.
2) can I get the system colour for that?

Probably not. However, assigning the empty string to a style object's
property resets it to the original value.


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top