< H:的inputText>启用/禁用 - 更改背景颜色 [英] <h:inputText> enabled/disabled - change background color

查看:90
本文介绍了< H:的inputText>启用/禁用 - 更改背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否可以更改背景颜色以禁用< h:inputText>



我试过这样做:

 < h:inputText value =testdisabled =truestyleClass =input/> 

css包含:

  input:disabled {background-color:blue;} 
input:enabled {background-color:red;}

,结果为:




原因,为什么我要改变背景是因为我安装了richfaces,禁用并启用了相同的颜色,都是白色的



谢谢

更新:





HTML:

 < td class =width10> ; SMENA:其中; / TD> 
< td class =width15>< input name =bde:j_idt100value =2011-05-18-S2size =13style =background-color:blue; color :红色; disabled =disabledtype =text>< input id =bde:shiftname =bde:shifttype =hidden>< / td>
< td>< input name =bde:j_idt102value =ranníclass =input2size =13disabled =disabledtype =text>< input name = bde:j_idt103value =adminclass =input2size =13disabled =disabledtype =text>< / td>
< / tr>
< tr class =rowEven>
< td class =width5>< input id =bde:f1name =bde:f1value =F1tabindex =2title =Novy pracovnik - vymaze vsechna pole formulareclass =btninputtype =submit>< / td>
< td class =width10>Pracovník:< / td>
< td class =width15>
< input id =bde:workername =bde:workerclass =inputsize =13tabindex =1onblur =jsf.util.chain(this,event,' mojarra.ab(这一点,事件,\'blur\ '\ '@ this\',\'bde:inputName\ ')',' mojarra.ab(这一点,事件,\'blur \,\ '@ this\',\'bde:inputSname\ ')', 'mojarra.ab(此,事件,\'blur\',\ '@ this\' ,\'bde:inputDep\ ')', 'mojarra.ab(此,事件,\'blur\',\ '@ this\',\'bde:reportErr\ ')' )type =text>< / td>




图示差异在richfaces生成的代码和HTML之间:



解决方案


原因,为什么我想改变背景,因为我安装了richfaces,禁用并启用了相同的颜色,两者都是白色


RichFaces附带自己的基本皮肤。在RichFaces 4.0上,您可以通过 web.xml 中的以下上下文参数完全禁用它。



禁用标准皮肤样式表(请参阅链接开发人员指南的第6.6.1章)

 < context-param> 
< param-name> org.richfaces.enableControlSkinning< / param-name>
< param-value> false< /参数值>
< / context-param>

这会禁用组件特定的外观样式表(请参阅第6.6.2章)

 < context-param> 
< param-name> org.richfaces.enableControlSkinningClasses< / param-name>
< param-value> false< /参数值>
< / context-param>

如果您因某种原因不想禁用基本皮肤,而是想重写特定的CSS属性/属性,那么你需要在你自己的CSS中精确地指定那些属性/属性。使用 Firebug ,您可以右键单击感兴趣的元素并选择检查元素以获取所有定义的CSS属性在底部控制台的右侧。

在这种特殊情况下,输入有一个 background-image 属性指向特定的URL。您需要像下面这样覆盖它:

  input {
background-image:none;
}


can I change background color for disabled <h:inputText>?

I've tried to do this way:

<h:inputText value="test" disabled="true" styleClass="input"/>

css contains:

input:disabled {background-color:blue;}
input:enabled {background-color:red;}

and result is:

reason, why I'm trying to change the background is, that since I've installed richfaces, disabled and enabled has the same color, both are white

Thank you

UPDATE:

HTML:

<td class="width10">Směna:</td>
<td class="width15"><input name="bde:j_idt100" value="2011-05-18-S2" size="13" style="background-color: blue; color: red;" disabled="disabled" type="text"><input id="bde:shift" name="bde:shift" type="hidden"></td>
<td><input name="bde:j_idt102" value="ranní" class="input2" size="13" disabled="disabled" type="text"><input name="bde:j_idt103" value="admin" class="input2" size="13" disabled="disabled" type="text"></td>
</tr>
<tr class="rowEven">
<td class="width5"><input id="bde:f1" name="bde:f1" value="F1" tabindex="2" title="Novy pracovnik - vymaze vsechna pole formulare" class="btninput" type="submit"></td>
<td class="width10">Pracovník:</td>
<td class="width15">
<input id="bde:worker" name="bde:worker" class="input" size="13" tabindex="1" onblur="jsf.util.chain(this,event,'mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputName\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputSname\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputDep\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:reportErr\')')" type="text"></td>

Graphic differences between richfaces generated code and HTML:

解决方案

reason, why I'm trying to change the background is, that since I've installed richfaces, disabled and enabled has the same color, both are white

RichFaces ships with its own basic skinning. On RichFaces 4.0 you can disable it altogether by the following context parameters in web.xml.

This disables the standard skin stylesheets (see chapter 6.6.1 of the linked developer guide)

<context-param>
    <param-name>org.richfaces.enableControlSkinning</param-name>
    <param-value>false</param-value>
</context-param>

This disables the component specific skin stylesheets (see chapter 6.6.2)

<context-param>
    <param-name>org.richfaces.enableControlSkinningClasses</param-name>
    <param-value>false</param-value>
</context-param>

If you however don't want to disable the basic skinning for some reason, but rather want to override specific CSS property/properties, then you need to specify exactly those property/properties in your own CSS. Using Firebug, you can rightclick the element of interest and choose Inspect Element to get all definied CSS properties in the right hand side of the bottom console.

In this particular case, the input has a background-image property pointing to a particular URL. You need to override it like as follows:

input { 
    background-image: none;
}

这篇关于&LT; H:的inputText&GT;启用/禁用 - 更改背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆