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)");

        }

原文地址:https://www.cnblogs.com/lauplay/p/2990205.html