?
Solved

Javascript - open new window always on top

Posted on 2007-10-18
3
Medium Priority
?
3,879 Views
Last Modified: 2011-02-08
When the user clicks on the link, it opens a history transaction window on the top of the screen in a specific place.  If they click back to the main page and then click the link again, it opens but behind the screen that has the focus.  How do I make this on top when they click it so that even if it was left open behind the screen it opens on top?  Thanks.

Here's my code

<A href="##" style="cursor: hand;" title="Click here for transaction history" onClick="window.open('index.cfm?fuseaction=form.History','HistoryDetail', 'location=no, menubar=no, resizable=yes, scrollbars=yes, width = 600, height = 300, screenX=300, screenY=300, top=400, left=400'); return false" target="HistoryPage" class="notetext"><img src="Images/history3.gif" border="0"> View Transaction History</a></cfif>
0
Comment
Question by:YLaw
3 Comments
 
LVL 10

Accepted Solution

by:
NeoTeq earned 2000 total points
ID: 20102079
Add focus to the child window on the click of the link...

<A href="##" style="cursor: hand;" title="Click here for transaction history" onClick="win = window.open('index.cfm?fuseaction=form.History','HistoryDetail', 'location=no, menubar=no, resizable=yes, scrollbars=yes, width = 600, height = 300, screenX=300, screenY=300, top=400, left=400'); win.focus(); return false" target="HistoryPage" class="notetext"><img src="Images/history3.gif" border="0"> View Transaction History</a>
0
 

Author Comment

by:YLaw
ID: 20102369
Great. Thanks
0
 
LVL 82

Expert Comment

by:hielo
ID: 20102431
Try this:
<script type="text/javascript">
var popUpWin=null;
function opener(uri,winName,features)
{
      if(null===popUpWin || !popUpWin.focus())
      {
            popUpWin=window.open(uri,winName, features);
      }

return false;
}
</script>
<A href="##" style="cursor: hand;" title="Click here for transaction history" onClick="return opener('index.cfm?fuseaction=form.History','HistoryDetail','location=no, menubar=no, resizable=yes, scrollbars=yes, width = 600, height = 300, screenX=300, screenY=300, top=400, left=400')" target="HistoryPage" class="notetext"><img src="Images/history3.gif" border="0"> View Transaction History</a>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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 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…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

864 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