簡體   English   中英

<h:inputText>啟用/禁用 - 更改背景顏色

[英]<h:inputText> enabled/disabled - change background color

我可以更改禁用<h:inputText>背景顏色嗎?

我試過這樣做:

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

css包含:

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

結果是:

在此輸入圖像描述

原因,為什么我要改變背景是,因為我已經安裝了richfaces,禁用和啟用了相同的顏色,都是白色的

謝謝

更新:

在此輸入圖像描述

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>

richfaces之間的圖形差異生成代碼和HTML:

在此輸入圖像描述在此輸入圖像描述

試試這個

<h:inputText value="test" disabled="disabled" style="background-color:blue; color:red;" />

原因,為什么我要改變背景是,因為我已經安裝了richfaces,禁用和啟用了相同的顏色,都是白色的

RichFaces有自己的基本皮膚 在RichFaces 4.0上,您可以通過web.xml的以下上下文參數完全禁用它。

這將禁用標准皮膚樣式表(請參閱鏈接的開發人員指南的第6.6.1章)

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

這將禁用特定於組件的外觀樣式表(請參閱第6.6.2章)

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

但是,如果您因某些原因不想禁用基本外觀,而是想要覆蓋特定的CSS屬性/屬性,則需要在自己的CSS中准確指定這些屬性/屬性。 使用Firebug ,您可以右鍵單擊感興趣的元素,然后選擇Inspect Element以在底部控制台的右側獲取所有定義的CSS屬性。

在此特定情況下, input具有指向特定URL的background-image屬性。 您需要覆蓋它,如下所示:

input { 
    background-image: none;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM