Modal PoPUp Window

Posted on 2006-04-01
Last Modified: 2012-08-13
Hi Guys,

I am trying to make a popup window Modal, thus to say prevent the user
from clicking on anything else until the child window is closed.
How can i achieve this with a cross browser code .  Most importantly i need to  move data bewteen both
windows, parent & child window s(var ParentWin = window.opener.document.form;)

Can someone please provide a sample of this, thanks very much in advance

function popup(){
 childWin ='ChildWin.html','name','height=400,width=850,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
Question by:mi_cky
    LVL 6

    Expert Comment

    Hi mi_cky,

    Maybe this can help.
    There are a lot of answers on the Internet too. Try Googling on "javascript popup modal"

    Hope this helps

    Author Comment

    Hi ,
    I have tried the above and it deosnt seem to work, Please note, the triggering of the pop is done by selecting a value from a drop down menu list <option> </option>. The pop is still model.

    LVL 6

    Expert Comment

    Here is a page with an example modal popup but it only works with IE. For what I have read it's not so easy to create a real modal window and to make it work for all browsers seems to be nearly impossible.

    How the popup is triggered doesn't matter. Trigger calls JavaScript => JavaScript calls popup.

    Maybe another JS guru can add some comments here.

    LVL 7

    Expert Comment

    Try this.. add to parent page

    window.onfocus = new Function('if (childWin && !childWin.closed) { childWin.focus() } ');
    LVL 2

    Accepted Solution

    on Internet Explorer u can use window.showModalDialog
    it supports only one argument but can be an object so there is no problem on return you must use event.returValue that can be another object

    on Mozilla u can use the feature "modal=yes"

    apart from this options u can also use the trick explained before of returning the focus to the window when its lost

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    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 …
    Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult 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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now