Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-08-20
5
Medium Priority
?
321 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
  • 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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

886 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