这样创建元素不免有点麻烦,有哪位同学可以写出那种遍历的方式?循环调用document.creatElement和自定class?
思考了一下写出来了
function Resizable(id){ var panel = document.getElementById(id); var data = ["r","b","rb"]; data.reverse(); for (var i = data.length - 1; i >= 0; i--) { (function(){ var cDiv = data[i]; cDiv = document.createElement('div'); cDiv.class = cDiv.className = 'ui-Resizable-'+data[i]+' ui-Resizable-ctrl' panel.appendChild(cDiv); })() }; } Resizable('ui-resizable');