在客户端用脚本实现hyperlink的navigateurl 动态变化?
有三个控件,文本控件
<asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 368px; POSITION: absolute; TOP: 136px" runat="server">aaa</asp:textbox>
下拉框
<asp:dropdownlist id="DropDownList1" style="Z-INDEX: 102; LEFT: 272px; POSITION: absolute; TOP: 136px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:dropdownlist>
超级链接
<asp:hyperlink id=HyperLink1 style="Z-INDEX: 103; LEFT: 536px; POSITION: absolute; TOP: 136px"
runat="server" NavigateUrl="index.aspx?a=<%=TextBox的值%>&b=<%=下拉框所选择的值%>">HyperLink</asp:hyperlink>
有三个控件,文本控件
<asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 368px; POSITION: absolute; TOP: 136px" runat="server">aaa</asp:textbox>
下拉框
<asp:dropdownlist id="DropDownList1" style="Z-INDEX: 102; LEFT: 272px; POSITION: absolute; TOP: 136px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:dropdownlist>
超级链接
<asp:hyperlink id=HyperLink1 style="Z-INDEX: 103; LEFT: 536px; POSITION: absolute; TOP: 136px"
runat="server" NavigateUrl="index.aspx?a=<%=TextBox的值%>&b=<%=下拉框所选择的值%>">HyperLink</asp:hyperlink>
this.HyperLink1.NavigateUrl=="index.aspx?a="+this.TextBox1.text+"&b="+this.DropDownList1.selectedValue;
这样不行吗?
在客户端用脚本实现hyperlink的navigateurl 动态变化。
var a1 = document.getElementById("TextBox1").value;
var drop = document.getElementById("DropDownList1");
var b1 = drop.options[drop.selectedIndex].value;
document.getElementById("HyperLink1").href = index.aspx.aspx?a="+a1+"&b="+b1;
}
所要注意的是index.aspx路径