Solved

onload=window.focus doesn't work when calling page with anchor in url

Posted on 2004-08-20
5
318 Views
Last Modified: 2008-03-03
Hi,

I have several popup windows on my site and if one is already popped up and in the background, when it is called with an anchor in the url the page stays in the background and ignores the body tag with window focus in it. Is there a simple solution for this problem.

Thanks
0
Comment
Question by:Chris_Granger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 11854886
<A href="somepage.html#someAnchor" target="popupName" onclick="window.open('',this.target).focus();" >
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11854896
assuming the popup exists already, that will put focus on the popup before it moves to the anchor ... otherwise it will open the popup and then load the page.  However, I forgot to return true from the onclick:

<A  href="somepage.html#someAnchor"  target="popupName"  onclick="window.open('',this.target).focus();return true;" >
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11854905
to clarify the onclick, I am swapping the double and single quotes around:

onclick='window.open("",this.target).focus();return true;'
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 250 total points
ID: 11855086
also, if the popup exists already, then the anchor by itself should be sufficient:

<A  href="#someAnchor"  target="popupName"  onclick='window.open("",this.target).focus();return true;' >
0
 

Author Comment

by:Chris_Granger
ID: 11858316
Thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help with this homework problem. 5 77
Put javascript to get dropdown value 3 33
javascript duplicates 9 25
Check for Numeric Phone Field 14 47
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question