with(document.all("listBox1")){
for(i=0;i<length;i++)alert(options[i].value)
}

解决方案 »

  1.   

    为什么提示缺少对象呢?(附代码?!)
     function change()
         {
            var addOption=document.createElement("option")
            var index1
         if(document.all.ListBox1.length==0)return(false);
           index1=document.all.ListBox1.selectedIndex 
         if(index1<0)return(false);
          addOption.text=document.all.ListBox1.options(index1).text
          addOption.value=document.all.ListBox1.value
          with(document.all("ListBox1"))
          {
             for(i=0;i<length;i++)
              if(addOption.text!=document.all.ListBox1.options(i).text)
            {
            document.all.ListBox2.add(addOption);
            document.all.ListBox1.remove(index1);
           }
         
         }