从弹出窗口获取后焦点到父窗口控件 [英] Get Back focus to Parent window control from Popup window

查看:350
本文介绍了从弹出窗口获取后焦点到父窗口控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家晚上好,

我有父窗口ParentForm&子窗口Popup.aspx。从按钮中的父窗口(onClientClick)我打开子窗口。好的。

现在问题是当用户按下时逃避 popup.aspx 将关闭那个'我也做过。

但是在关闭子窗口时,我的控制焦点需要是在父窗口按钮(btnSubmit)按钮。我谷歌但没有一个好主意,任何身体PLZ帮助我。





这是我用来关闭弹出窗口的代码



  function  doClose(e){
if (!e)e = window .event;

if (e.keyCode){
if (e.keyCode == 27){

window .close();
}
}
else if (e.charCode){
if (e.charCode == 27){

window .close();
}
}
} document .onkeydown = doClose;



上面的函数在中调用popup.aspx(body onKeydown =doClose(evt);





在此先感谢,对不起英语。

解决方案

查看窗口对象: http://www.w3schools.com/jsref/obj_window.asp [ ^ ]。



您将找到两个可以帮助您实现目标的成员:

http:/ /www.w3schools.com/jsref/prop_win_parent.asp [ ^ ],

http://www.w3schools.com/jsref/met_win_focus.asp [ ^ ]。



请试试。



-SA

Hi all good evening,
I have parent window "ParentForm" & child window "Popup.aspx". From the parent window in a button (onClientClick") i am opening the Child window. thats ok.
Now the problem is when user is press escape that popup.aspx will close that''s also i have done.
But while closing the Child window, My control focus need to be on Parent window button(btnSubmit) button. I google but not got a good idea, any body plz help me.


This is the code i am using to close the popup window

function doClose(e) {
            if (!e) e = window.event;
           
            if (e.keyCode) {
                if (e.keyCode == "27") {
                    
                    window.close();
                }
            }
            else if (e.charCode) {
            if (e.charCode == "27") {
                
                window.close();
            }
            }
        }        document.onkeydown = doClose;


The above function is called in popup.aspx (body onKeydown="doClose(evt");"


Thanks in advance, sorry for the english.

解决方案

Look at the window object: http://www.w3schools.com/jsref/obj_window.asp[^].

You will find exactly two members which will help you to achieve what you want:
http://www.w3schools.com/jsref/prop_win_parent.asp[^],
http://www.w3schools.com/jsref/met_win_focus.asp[^].

Please try.

—SA


这篇关于从弹出窗口获取后焦点到父窗口控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆