0

我的页面中有asp菜单项按钮。因此,当我单击该按钮时,我需要在当前选项卡上打开一个弹出窗口并打开一个新选项卡并专注于它。当用户返回到实际选项卡时,将在弹出窗口中单击“确定”,然后再继续执行任何操作。这就是我到目前为止所得到的:

var menuTable = document.getElementById("<%=ASPTableMenu.ClientID%>");
var menuLinks = menuTable.getElementsByTagName("a");
menuLinks[0].onclick = function () {  
    var winPopup = window.open("z_container.aspx"); 
    if (winPopup) { 
        winPopup.focus();
    } 
    alert('test'); 
}

我需要打开一个带有确定按钮的弹出窗口,而不是警报,当用户单击确定时,我需要运行一些条件。

谢谢

4

1 回答 1

0

您必须使用确认来代替警报:

var menuTable = document.getElementById("<%=ASPTableMenu.ClientID%>");
var menuLinks = menuTable.getElementsByTagName("a");
menuLinks[0].onclick = function () {  
    var winPopup = window.open("z_container.aspx"); 
    if (winPopup) { 
        winPopup.focus();
    } 
    //alert('test'); 
    if (confirm("Your message here")) {
        //OK button clicked; add your code here
    }
}
于 2013-09-21T02:44:54.270 回答