<div class="codetitle"> <span><a style="CURSOR: pointer" data="91358" class="copybut" id="copybut91358" onclick="doCopy('code91358')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code91358"> <br><script type="text/javascript"> <BR>function GetValue() { <BR>var strlist = document.getElementById("ListBox1");//获取Listbox <BR>var str= ""; <BR>//遍历Listbox,取得选中项的值 <BR>if (strlist.options.length > 0) { <BR>for (var i = 0; i < strlist.options.length; i++) { <BR>if (strlist.options[i].selected == true) { <BR>var j = strlist.options[i].value; <BR>str+=j+","; //把Value值串起来<BR>} <BR>} <BR>var strValue=str.replace(/,$/, ""); //去掉最后一个逗号 <BR>alert(strValue); <BR>} <BR>else { <BR>alert("No Item in Listbox"); <BR>} <BR>} <BR></script><br> </div>