首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Extjs中怎么改变控件字体的颜色

2012-03-25 
Extjs中如何改变控件字体的颜色改变下面checkbox中“水稻”、“小麦”、“油菜”的字体颜色用什么属性?找了半天没

Extjs中如何改变控件字体的颜色
改变下面checkbox中“水稻”、“小麦”、“油菜”的字体颜色
用什么属性?找了半天没找到。。。


[解决办法]
用firebug找DOM结构直接操作css

HTML code
<style>.x-form-cb-label{    color:red;}</style>
[解决办法]
根据checkbox的id用脚本修改:
Ext.select("label.x-form-cb-label[for=checkboxID]").item(0).dom.style.color = 'red';

HTML code
<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>
[解决办法]
JScript code
<style>    .required .x-form-item-label {font-weight:bold;color:red;}</style>增加属性itemCls:'required' 

热点排行