我做了一个动态生成的下拉列表。想在提交时,将列表中的所有值全部选中,再提交。
不知道各位大侠有什么方法?
for (i=0; i<document.Form1.selectname.length; i++)
document.Form1.selectname.options[i].selected =true;
for(i=0;i<document.form1.elements.length;i++)
{var e=document.form1.elements[i];
if(e.name==selectname)
e.checked=true;
}
列表属性要选择为允许多选;具体方法,楼上已经给您很好的例子