展开全部
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function GetList() {
var lstStaffs = document.getElementById("lstStaffs");
var strStaffs = "";
for (var i = 0; i < lstStaffs.options.length; i++) {
strStaffs += "第" + (i + 1) + "个是" + lstStaffs.options[i].value + "<br />";
}
document.getElementById("divStaffs").innerHTML = strStaffs;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ListBox ID="lstStaffs" runat="server">
<asp:ListItem>aaaa</asp:ListItem>
<asp:ListItem>bbbb</asp:ListItem>
<asp:ListItem Value="cccc">cccc</asp:ListItem>
</asp:ListBox>
<br />
<input id="Button1" type="button" onclick="GetList();" value="button" />
<div id="divStaffs">
</div>
</form>
</body>
</html>
<title></title>
<script language="javascript" type="text/javascript">
function GetList() {
var lstStaffs = document.getElementById("lstStaffs");
var strStaffs = "";
for (var i = 0; i < lstStaffs.options.length; i++) {
strStaffs += "第" + (i + 1) + "个是" + lstStaffs.options[i].value + "<br />";
}
document.getElementById("divStaffs").innerHTML = strStaffs;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ListBox ID="lstStaffs" runat="server">
<asp:ListItem>aaaa</asp:ListItem>
<asp:ListItem>bbbb</asp:ListItem>
<asp:ListItem Value="cccc">cccc</asp:ListItem>
</asp:ListBox>
<br />
<input id="Button1" type="button" onclick="GetList();" value="button" />
<div id="divStaffs">
</div>
</form>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询