用什么属性?找了半天没找到。。。
5 个解决方案
#1
用firebug找DOM结构直接操作css
<style>
.x-form-cb-label{
color:red;
}
</style>
#2
如果我想设置水稻一种颜色,小麦一种颜色,油菜一种颜色,该如何做呢?
#3
根据checkbox的id用脚本修改:
Ext.select("label.x-form-cb-label[for=checkboxID]").item(0).dom.style.color = 'red';
Ext.select("label.x-form-cb-label[for=checkboxID]").item(0).dom.style.color = 'red';
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script>
Ext.onReady(function(){
oForm = new Ext.FormPanel({
renderTo:"form_panel",
layout:"form",
hideLabels:true,
border:false,
items:[
{xtype:'checkbox',id:'x1',inputValue:'x',boxLabel:'水稻'},
{xtype:'checkbox',id:'x2',inputValue:'x',boxLabel:'小麦'}
]
});
Ext.select("label.x-form-cb-label[for=x1]").item(0).dom.style.color = 'red';
});
</script>
<div id="form_panel"></div>
#4
<style>
.required .x-form-item-label {font-weight:bold;color:red;}
</style>
增加属性
itemCls:'required'
#5
++
#1
用firebug找DOM结构直接操作css
<style>
.x-form-cb-label{
color:red;
}
</style>
#2
如果我想设置水稻一种颜色,小麦一种颜色,油菜一种颜色,该如何做呢?
#3
根据checkbox的id用脚本修改:
Ext.select("label.x-form-cb-label[for=checkboxID]").item(0).dom.style.color = 'red';
Ext.select("label.x-form-cb-label[for=checkboxID]").item(0).dom.style.color = 'red';
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script>
Ext.onReady(function(){
oForm = new Ext.FormPanel({
renderTo:"form_panel",
layout:"form",
hideLabels:true,
border:false,
items:[
{xtype:'checkbox',id:'x1',inputValue:'x',boxLabel:'水稻'},
{xtype:'checkbox',id:'x2',inputValue:'x',boxLabel:'小麦'}
]
});
Ext.select("label.x-form-cb-label[for=x1]").item(0).dom.style.color = 'red';
});
</script>
<div id="form_panel"></div>
#4
<style>
.required .x-form-item-label {font-weight:bold;color:red;}
</style>
增加属性
itemCls:'required'
#5
++