Art to do the CSS style icon more and more, hand to write icon name is almost impossible to achieve. So there is this function point: the CSS style of all the icon class enumerated in a graphical format for the configuration of the selection of personnel!
Search a circle, found that the introduction of the article from the CSS to traverse things very little. So spent half a day to realize it! First look at the next selection icon Demo:
Here is the Easyui: a comboxtree.
This omits code that references CSS and JS libraries (jquery and Easyui libraries).
Html:
Copy Code code as follows:
<input id= "CC" class= "Easyui-combotree" style= "width:200px"; >
Javascript:
Copy Code code as follows:
function GetStyle () {
for (var i = 0; i < document.styleSheets.length; i++) {
VAR rules;
if (document.stylesheets[i].cssrules) {
Rules = Document.stylesheets[i].cssrules;
}
else {
Rules = Document.stylesheets[i].rules;
}
for (var j = 0; J < Rules.length; J + +) {
if (rules[j].selectortext.substr (0, 5) = = ". Icon")
$ (' #cc '). Combotree (' tree '). Tree (' append ', {
Data: [{
ID:RULES[J].SELECTORTEXT.SUBSTR (1),
TEXT:RULES[J].SELECTORTEXT.SUBSTR (1),
ICONCLS:RULES[J].SELECTORTEXT.SUBSTR (1)
}]
});
}
}
}
$ (function () {
GetStyle ();
});
There are several possible problems:
1. Large project styles can be huge, and this traversal is clearly not possible and needs to be assigned to stylesheets.
2. If the various size of the icon may be used easyui-combotree not very reasonable.
Finally through the configuration icon generated menu effect: