網路上的找到的方法:
aspx端 javascript
function autoscroll() { var list = document.getElementById("ListBox名稱");
//找到ListBox物件(使用檢視原碼碼去找ID比較準確) if (!list || !list.multiple || list.length == 0) return; var lastItem = list[list.length - 1]; if (lastItem.selected) { lastItem.selected = true; return; } else { lastItem.selected = true; lastItem.selected = false; } for (var i = 0; i < list.length; i++) { if (list[i].selected) // or list.selected ? { list[i].selected = true; return; } } }
vb端
Page.RegisterStartupScript("MyScript", "<Script language=javascript defer='true'> autoscroll() </script>")目前測試結果不包UpdatePanel運作正常包了則無作用