Connecting Tech Pros Worldwide Help | Site Map

Button to loose focus after close of popup window

Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#1: 4 Weeks Ago
Good day, I need help.

I have an html button that calls & open another browser window on the onMouseUp event, but once I close the popup new browser window my button has focus & is like selected.

I want it not to be selected or clicked or has focus, how do i loose the focus after close of popup window?

Expand|Select|Wrap|Line Numbers
  1. onMouseUp="window.open("
  2.  
Please Assist!
best answer - posted by acoder
Have you tried blur(), or giving focus to another element?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: 4 Weeks Ago

re: Button to loose focus after close of popup window


maybe something like
Expand|Select|Wrap|Line Numbers
  1. window.opener.focus();
  2. window.close();
could work.
Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#3: 4 Weeks Ago

re: Button to loose focus after close of popup window


No luck, I tried on the same event:
Expand|Select|Wrap|Line Numbers
  1. onMouseUp="window.open(); window.opener.focus();window.close();" 
  2.  
the same result - please assist!
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: 4 Weeks Ago

re: Button to loose focus after close of popup window


futile. of course you have to call this snippet in the opened window (where should window.opener come from in a normal window?)
Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#5: 4 Weeks Ago

re: Button to loose focus after close of popup window


i have tried but no luck
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#6: 4 Weeks Ago

re: Button to loose focus after close of popup window


I’m not that good with focus(), but I could prove the concept with alert()
Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#7: 4 Weeks Ago

re: Button to loose focus after close of popup window


not sure what to do !
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#8: 4 Weeks Ago

re: Button to loose focus after close of popup window


Have you tried blur(), or giving focus to another element?
Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#9: 3 Weeks Ago

re: Button to loose focus after close of popup window


Thanks onBlur(); works great :)
Reply