日期:2014-05-18  浏览次数:20539 次

帮我看看这个怎么样取值比较好呀
<script   language= "javascript ">
<!--
function   Add(ObjSource,ObjTarget){
//var   str   =   " ";
for(var   i=ObjSource.length-1;i> =0;i--){
if(ObjSource.options[i].selected){
//str   +=   ObjSource.options[i].value+ ", ";
ObjTarget.add(new   Option(ObjSource.options[i].text,ObjSource.options[i].value,true));
ObjSource.options.removeChild(ObjSource.options[i]);


}
}
//document.getElementById( "cod ").value   =   str;
}
function   AddAll(ObjSource,ObjTarget){
SelectAll(ObjSource);
Add(ObjSource,ObjTarget);
}
function   SelectAll(ObjSource){
for(var   i=0;i <ObjSource.length;i++){
ObjSource.options[i].selected=true;
}
}
function   doSubmit(){
SelectAll(Form1.TpTarget);
Form1.action= " ";//设置form   提交的action
//alert(frmDisplay.action);
Form1.submit();//取消注释即可,提交上去的options

}
function   getDvalue(){
var   str   =   document.getElementById( "cod ");
var   dlist   =   document.getElementById( "TpTarget ");
for(var   i   =   0;   i   <dlist.options.length;   i++){
      str.value   +=   dlist.options[i].value;
}
}

//-->
</script>


<TABLE   style= "WIDTH:   80%;   HEIGHT:   306px ">
<TR>
<TD   align= "center ">
<asp:listbox   id= "TpSource "   Runat= "server "   CssClass= "listbox1 "   SelectionMode= "Multiple "> </asp:listbox> </TD>
<TD   align= "center ">
<P> <INPUT   class= "btn11 "   title= "添加 "   onclick= "Add(document.all.TpSource,document.all.TpTarget); "
type= "button "   value= "添加 "> </P>
<P> <INPUT   class= "btn11 "   title= "添加全部 "   onclick= "AddAll(document.all.TpSource,document.all.TpTarget); "
type= "button "   value= "添加全部 "> </P>
<P> <INPUT   class= "btn11 "   title= "删除 "   onclick= "Add(document.all.TpTarget,document.all.TpSource); "
type= "button "   value= "删除 "> </P>
<P> <INPUT   class= "btn11 "   title= "删除全部 "   onclick= "AddAll(document.all.TpTarget,document.all.TpSource); "
type= "button "   value= "删除全部 "> </P>
</TD>
<TD   align= "center ">
<asp:listbox   id= "TpTarget "   Runat= "server "   CssClass= "listbox1 "   SelectionMode= "Multiple "> </asp:listbox>
<input   id= "cod "   type= "hidden "   runat= "server "   NAME= "cod "   value= "getDvalue(); ">
</TD>
</TR>
</TABLE>


怎么样在提交的时候能取到TpTarget的值呀?