Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Getting default colour for <input> - or just the old colour (http://www.velocityreviews.com/forums/t934218-getting-default-colour-for-input-or-just-the-old-colour.html)

jodleren 01-11-2008 07:03 AM

Getting default colour for <input> - or just the old colour
 
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";

David Mark 01-11-2008 08:26 AM

Re: Getting default colour for <input> - or just the old colour
 
On Jan 11, 2:03*am, jodleren <sonn...@hot.ee> wrote:
> 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.

Thomas 'PointedEars' Lahn 01-12-2008 02:57 PM

Re: Getting default colour for <input> - or just the old colour
 
jodleren wrote:
> 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


All times are GMT. The time now is 05:59 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.