需求:给easyui的datagrid的contentMenu中改变颜色: 步骤1. 初始化菜单的时候,利用setTimeout在菜单初始化后再改变颜色: /** * 右键菜单项 * @returns {Array} 菜单内容 */ function createMenu(falg){ var menuObj = [ { text: "标记", iconCls: "icon-hamburg-statistics", children: [ { text: "<font color='#FF0000' class='_color'>红色</font>", iconCls: "icon-standard-pencil", handler: function (e,row) { setColorFun(row,'#FF0000'); } }, { text: "<font color='#FF7F00' class='_color'>橙色</font>", iconCls: "icon-standard-pencil", handler: function (e,row) { setColorFun(row,"#FF7F00"); } }, ] } ]; setTimeout(function(){ initColorMenuFun(); },100); return menuObj;