当我从列表中选择一个项目时,我有一个下拉列表会打开一个新窗口。如何将下拉列表值传递到 URL 中的新窗口?
我的代码如下所示:
<asp:DropDownList ID="ddlAdd" runat="server" CssClass="ddl" OnChange="javascript:openWindow('add.aspx?ddlAddValue=', 800, 885)">
<asp:ListItem>One</asp:ListItem>
<asp:ListItem>Two</asp:ListItem>
<asp:ListItem>Three</asp:ListItem>
</asp:DropDownList>
这是 JavaScript 函数:
function openWindow(url, windowHeight, windowWidth)
{
var centerHeight = (screen.height - windowHeight) / 2;
var centerWidth = (screen.width - windowWidth) / 2;
var features = "height=" + windowHeight + ", width=" + windowWidth + ", top=" + centerHeight + ", left=" + centerWidth + ", scrollbars=" + 1;
var popUp = window.open(url, "", features);
}