Javascript - focus on calling window after a close - Stack Overflow

I want toA) open a pop up window via javascript - easy enoughB) close this window via Javascript - easy

I want to

A) open a pop up window via javascript - easy enough

B) close this window via Javascript - easy enough

C) ensure that the window that spawned the popup in A is focused on again when close in B. Seem to remember can do this but can't remember how.

I want to

A) open a pop up window via javascript - easy enough

B) close this window via Javascript - easy enough

C) ensure that the window that spawned the popup in A is focused on again when close in B. Seem to remember can do this but can't remember how.

Share Improve this question edited Sep 1, 2010 at 12:31 Pranay Rana 177k37 gold badges243 silver badges266 bronze badges asked Sep 1, 2010 at 11:11 AJMAJM 32.6k50 gold badges161 silver badges248 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

script for closing child window and put focus back on parent window

window.opener.focus(); 
window.close();

Probably the user can close the popup in many ways as with a link, button or close button so a good way is to use the event onunload

so put this in the popup window

window.onunload = function(){
   window.opener.focus(); 
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745591662a4634870.html

相关推荐

  • Javascript - focus on calling window after a close - Stack Overflow

    I want toA) open a pop up window via javascript - easy enoughB) close this window via Javascript - easy

    10小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信