日期:2014-05-16 浏览次数:20470 次
<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';
<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>
------解决方案--------------------
<style> .required .x-form-item-label {font-weight:bold;color:red;} </style> 增加属性 itemCls:'required'