转自:http://www.jb51.net/article/35162.htm
C# DropDownList中点击打开新窗口的方法,需要的朋友可以参考一下
1、页面上添加
- <asp:DropDownList ID="DropDownList1" runat="server">
- </asp:DropDownList>
复制代码
2、在head之间
- <script type="text/javascript">
- function openwindow(url) {
- if (url != "") {
- window.open(url);
- }
- }
- </script>
复制代码
3、cs代码
- protected void Page_Load(object sender, EventArgs e)
- {
- DropDownList1.Attributes.Add("onchange", "javascript:openwindow(this.value)");
- }
复制代码
|
|