亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js 獲取Listbox選擇的值的代碼

 更新時間:2010年04月15日 20:37:05   作者:  
將Listbox的 SelectionMode="Multiple",設(shè)置為多選時,用JS獲取多選的值。
復(fù)制代碼 代碼如下:

<script type="text/javascript">
function GetValue() {
var strlist = document.getElementById("ListBox1");//獲取Listbox
var str= "";
//遍歷Listbox,取得選中項的值
if (strlist.options.length > 0) {
for (var i = 0; i < strlist.options.length; i++) {
if (strlist.options[i].selected == true) {
var j = strlist.options[i].value;
str+=j+","; //把Value值串起來
}
}
var strValue=str.replace(/,$/, ""); //去掉最后一個逗號
alert(strValue);
}
else {
alert("No Item in Listbox");
}
}
</script>

相關(guān)文章

最新評論