$(function() { setSelectWidth(); }); /*** * 2016.03.01 * 庄会亮 * 功能:为页面下拉框和下拉树的宽度赋值。 * @returns */ function setSelectWidth(){ //为下拉框宽度赋值 $.each($(".selectWidth"),function(n,value) { var width = $(value).attr("swidth"); if(width==""||width==undefined){ return; } if(width!="100%"){ width = width.substring(0,width.length-1); if(width.indexOf(".")!=-1){ width=width/100; }else{ width = "0."+width; } }else{ width = 1; } width = parseInt($(value).parent().css("width"))*width; $(this).attr("selWidth",width); $(this).render(); }); }