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

        }

posted @ 2013-03-30 11:46  冰城小菜刀  阅读(154)  评论(0编辑  收藏  举报