弹出窗口弹出窗口,第二个弹出窗口没有焦点?

时间:2012-03-12 15:16:30

标签: javascript popup

好的,我知道这听起来很奇怪,但这是客户想要的。我在弹出窗口中工作,当用户点击某个列中的datagrid单元格时,它将弹出一个带有数据的html表。我有第二个弹出窗口显示但它没有得到焦点。这是我用来创建第二个弹出窗口的代码。任何有助于关注第二个弹出窗口的帮助都会很棒。

function onCellClick() {

        var cmGrid = igtbl_getGridById("countermeasureDetailsGrid");
        var cmCellID = cmGrid.ActiveCell.split("_");
        if (cmCellID[3] === "3") {
            var countermeasureID = igtbl_getCellById("countermeasureDetailsGrid_rc_" + cmCellID[2] + "_0").getValue();
            var recordType = igtbl_getCellById("countermeasureDetailsGrid_rc_" + cmCellID[2] + "_4").getValue();
            _crfPopupWindow = new crfPopupWindow(countermeasureID, recordType);

            _crfPopupWindow.open();
            _crfPopupWindow.focus();
        }
    }

    function crfPopupWindow(countermeasureID, recordType) {
        var crfPopup = new WindowDef();
        crfPopup.target = "CRF_Popup.aspx?countermeasureID=" + countermeasureID + "&" + "recordType=" + recordType;
        crfPopup.windowName = "CRFPopup";
        crfPopup.toolBar = "no";
        crfPopup.resizable = "yes";
        crfPopup.scrollbars = "yes";
        crfPopup.location = "yes";
        crfPopup.width = 350;
        crfPopup.height = 400;
        return crfPopup;
    }

编辑:解决方案

<script type="text/javascript" language="javascript">
    function init() {
        window.focus();
    }
</script>

2 个答案:

答案 0 :(得分:0)

您是否检查过第二张弹出窗口有z-index CSS property

第一个弹出窗口的z-index可以是1000,但是第二个弹出窗口应该有1001。

答案 1 :(得分:0)

页面加载时window.focus这是有效的