Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window.open as modal popup?

I want open window.open as modal popup.

 var features = 'resizable= yes; status= no; scroll= no; help= no; center= yes;
 width=460;height=140;menubar=no;directories=no;location=no;modal=yes';
    window.open(href, 'name', features, false);

I can use Window.ShowModelDialog(), but in my child window I am calling parent javascript method. That is not happening with ShowModelDialog().

 function CallParentScript(weburl) {
       alert(weburl);
       if (weburl != null) {
           var url = weburl;

            window.opener.SelectUserImageCallback(url);
            window.close();
            return false;
       }
   }

If I use window.open(). I can call Parent javascript. But window is not modal.

How to solve this? Can I write something in child popup to always top?

like image 466
James123 Avatar asked Oct 14 '10 21:10

James123


1 Answers

I agree with both previous answers. Basically, you want to use what is known as a "lightbox" - http://en.wikipedia.org/wiki/Lightbox_(JavaScript)

It is essentially a div than is created within the DOM of your current window/tab. In addition to the div that contains your dialog, a transparent overlay blocks the user from engaging all underlying elements. This can effectively create a modal dialog (i.e. user MUST make some kind of decision before moving on).

like image 70
Jonathan Nesbitt Avatar answered Sep 18 '22 08:09

Jonathan Nesbitt