我遇到了一些麻烦,经过相当多的研究后,无法找到解决方案。我在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