日期:2014-05-18 浏览次数:20415 次
<%@ Page Language="C#" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.HyperLink1.Attributes["onclick"] = "this.href+=document.getElementById('" + this.DropDownList1.ClientID + "').value;"; DropDownList1.SelectedValue = "s1"; this.Button1.OnClientClick = "window.open('newadd.aspx?ctype='+ document.getElementById('" + this.DropDownList1.ClientID + "').value,'Add','menubar=no,toolbar=no,location=no,directories=no,status=yes,width=740,height=400,left='+(window.screen.width-550)/2+',top='+(window.screen.height-350)/2+',scrollbars=yes');return false;"; } } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>s1</asp:ListItem> <asp:ListItem>s2</asp:ListItem> <asp:ListItem>s3</asp:ListItem> </asp:DropDownList> <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl="~/abc.aspx?xx=" CssClass="按钮样式">Click Me 1</asp:HyperLink> <asp:Button ID="Button1" runat="server" Text="Button" /> </form> </body> </html>
------解决方案--------------------
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ntype As String = DropDownList1.SelectedValue.ToString '--类型
Response.Write(" <script>window.open('newadd.aspx?ctype=" + ntype.ToString + "','Add','menubar=no,toolbar=no,location=no,directories=no,status=yes,width=740,height=400,left='+(window.screen.width-550)/2+',top='+(window.screen.height-350)/2+',scrollbars=yes') </script>")
End Sub
改成下面的看看:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ntype As String = DropDownList1.SelectedValue.ToString '--类型
Response.redirect(" <script>window.open('newadd.aspx?ctype=" + ntype.ToString + "','Add','menubar=no,toolbar=no,location=no,directories=no,status=yes,width=740,height=400,left='+(window.screen.width-550)/2+',top='+(window.screen.height-350)/2+',scrollbars=yes') </script>")
End Sub
------解决方案--------------------
估计是禁止了弹出窗口吧