| 
 | 浅谈<select  > 对象中option 的清空 
 intLength 为 option的个数 :document.all("lstUserId").options.length;
 lstUserId 为 <select id=lstUserId> 对象:
 <select id=lstUserId>
 <option >1</option>
 <option >3</option>
 <option >4</option>
 </select>
 
 方法一:
 for (var i=0; i<intLength-1;i++)
 {
 document.all("lstUserId").options.remove(i);
 }
 
 方法二:
 while (document.all("lstUserId").options.length>0)
 {
 document.all("lstUserId").option.remove(0);
 }
 
 
 方
            法一不能清空<select id=lstUserId>对象并且会报错。因为当
            document.all("lstUserId").options[0]被删除后
            document.all("lstUserId").options[intLength-1] 即最后一个option就不复存在了。
 所以从最后一个删起可以的从第一个删起始有问题的。
 而
            方法二是能清空的因为document.all("lstUserId").options[0]删除后
            document.all("lstUserId").options[1]变成了
            document.all("lstUserId").options[0]。直至删到最后一个。
 |