控制select的宽度
时间:2006-08-08 来源:qzc
var OptionLength=0;
var obj=document.getElementById("companyno");
for(var i=0;i<obj.options.length;i++)
{
if(obj.options[i].text.length>OptionLength)
{
OptionLength=obj.options[i].text.length;
}
}
OptionLength=OptionLength*15;
if(OptionLength<130)
OptionLength=130;
obj.style.width=OptionLength;
var obj=document.getElementById("companyno");
for(var i=0;i<obj.options.length;i++)
{
if(obj.options[i].text.length>OptionLength)
{
OptionLength=obj.options[i].text.length;
}
}
OptionLength=OptionLength*15;
if(OptionLength<130)
OptionLength=130;
obj.style.width=OptionLength;
相关阅读 更多 +