ul li * #waterFall #waterFall_1 .box .box_1 需传参数 father : "waterFall" //父级ID chilsNum :20, //子集个数 child : "box", //子集类名 childWidth : 200, //子集宽度 fatherWidth : 1100, //父级宽度 heightPdding : 10, //子集上下间距 */ function waterFall(opations){ ); opations.chilsNum; .father.children(); opations.childWidth ; opations.fatherWidth; ; ; opations.heightPdding; []; ; ; ; this.init(); } waterFall.prototype = { init:function(){ ){ ; ; .childNum){ ; ; ) }else{ .arrHeight); .fountMin(); ; ; .heightPdding; } } .arrHeight); ; ; ; }, fountMin:function(){ .arrHeight){ .arrHeight[x]){ return parseInt(x); } } }, } window.onload = function(){ (liNum,father,childName){ father.innerHTML = ""; ){ ); li.className = childName; li.style.height ; father.appendChild(li); }; } ; create(num1,document.getElementById() waterFall({ father : , child : , chilsNum :num1, childWidth : 130, fatherWidth : 850, heightPdding : 10, }) ; create(num2,document.getElementById() waterFall({ father : , child : , chilsNum :num2, childWidth : 160, fatherWidth : 900, heightPdding : 20, }) }