popup window to front

how do I bring a popup window to the front of the other pages in javascript?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you have any existing code? Or do you want the entire code, ready to use?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try the below technique, it sets the focus to your popup upon launch then it sets the focus back if your window lost focus, keeping it ontop

Have you also considered displaying a popup style div ?
You can try the below simple example which will display a popup style div.

    <style type="text/css">

      .popup {
        border: solid 1px #333;
        font-family: Tahoma;
        font-size: 12px;
        display: none;
        position: absolute;
        z-index: 60;

      .popuptitle {
        position: relative;
        background: blue;
        color: white;
        font-weight: bold;
        height: 15px;
        padding: 5px;
      .popuptitle input {
        position: absolute;
        font-size: 75%;
        right: 2px;
        top: 2px;
      .popupbody {
        background: #ddd;
        padding: 5px;
        text-align: center;

      #popup1 { top: 100px; left: 50px; width: 510px }
      #popup1 iframe { width: 500px; height: 400px }


    <script type="text/javascript">

      function popupWindow(o,u)
        // o - Object to display.
        // u - URL to display, null = hide popup.
        var obj = document.getElementById(o);
          obj.style.display = 'block';
          obj.style.display = 'none';



    <h1>Popup Style Window Using Elements</h1>

    <input type="button" value="Show Popup 1" onClick="popupWindow('popup1','http://www.google.com/');"/>

    <div id="popup1" class="popup">
      <div class="popuptitle">Popup 1<input type="button" value="Close" onClick="popupWindow('popup1');"/></div>
      <iframe name="popup1" class="popupbody" frameborder="0"></iframe>



Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

designaireAuthor Commented:
I ended up using this but the popup window doesn't stay in front.

    <!--Hide script from old browsers
function newWindow(newContent)
winContent = window.open(newContent, 'nextWin', 'right=300,top=150,width=890,height=757,toolbar=no,scrollbars=no,resizable=yes')
Hi designaire,
Please check this http://getyourwebsitehere.com/jswb/modwin/modalwinparent.html#pop , it's got plenty of techniques and you can try to get one that works for you, but please bear in mind that recent browsers are getting better and trying to fight such attitude, so not all scripts would function properly nowadays.

One example that worked for me, when you open the above link click the"  try the onBlur Focuser" it should do what you need, but please note that this method requires you to have control on the page being loaded into the frame in order to add the <body onblur = "window.focus( )">

So in your above example, add on onblur = "window.focus( )" to the body tag of  document_01.htm

Finally user can still persist and manage to escape it but it'll definitely be inconvenient and would be just easier to close


focus works fine for me.

If you are looking for modal kinds, consdier remorina suggestions.
I would prefer jquery modal window.

however focus still works fine for me in all browsers I have, IE >6, FF >2.. also chrome.
designaireAuthor Commented:
I really like how the css pop-up works. I'm going use that at some point, if not now, later...thanks for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.