我遇到了一些麻煩,經過相當多的研究後,無法找到解決方案。我在SharePoint Designer 2010中工作,並有一個由列表填充的ASP.net下拉列表。我想從下拉列表中獲取所選項目的索引值(例如1),並將其傳遞給用於調出EditForm.aspx頁面的URL。見下文,並感謝您提供任何幫助!JavaScript查找所選下拉列表項的索引,傳遞到超鏈接
<script type="text/javascript">
function redirect(url) {
var ddl = document.getElementById('DropDownList1');
alert("HI!");
var index = ddl.selectedIndex;
var value = ddl.options[index].value;
location.href = url + value;
return false;
}
</script>
<asp:LinkButton runat="server" id="LinkButton1"
href="https://chartiscorp.sp.ex3.secureserver.net/Lists/System_Information/EditForm.aspx?id="
onclientclick="javascript:redirect(this.href)">Edit System Info</asp:LinkButton>
<asp:DropDownList runat="server" id="DropDownList1" DataValueField="Title"
DataTextField="Title" DataSourceID="spdatasource1" />
請添加代碼'DropDownList1'。 – 2013-05-01 11:30:02
我在 – user2339121 2013-05-01 11:38:30