Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:40:09+00:00 2026-06-08T04:40:09+00:00

I have to open a window when a button is clicked, as a modal

  • 0

I have to open a window when a button is clicked, as a modal dialog using JavaScript.
I have used window.open, but it shows me two instances, the parent page and the pop-up page.
When the pop-up page is open, then do not allow the user to click on the parent page.

function openWindow() {
  var w = 950;
  var h = 350;
  var t = 0;
  var l = 0;
  var scrollbars = 1;
  var modal = 'yes';

  var reportWindow = window.open("Search.aspx" + '', '', "width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + ',scrollbars=' + scrollbars + 'modal' + modal);
  reportWindow.focus();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:40:11+00:00Added an answer on June 8, 2026 at 4:40 am

    Your code line,

    reportWindow = window.open("Search.aspx" + '', '', "width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + ',scrollbars=' + scrollbars + 'modal' + modal);
    

    is missing an ‘=’ symbol after modal. It should be,

    reportWindow = window.open("Search.aspx" + '', '', "width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + ',scrollbars=' + scrollbars + 'modal=' + modal);
    

    To open window as dialog box,

     <html>
        <body>
        <script language="JavaScript">
        function openWindow() {
           if (window.showModalDialog) {
    window.showModalDialog("http://example.com","name",
    "dialogWidth:255px;dialogHeight:250px");
    } else {
    window.open('http://example.com','name',
    'height=255,width=250,toolbar=no,directories=no,status=no, linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
        } 
        </script>
        <button onclick="openWindow();">Open window</button>
        </body>
        </html>
    

    If the above code is not working, please use jQuery modal dialog. You can load any urls to dialog using an iframe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used JavaScript to open a new window(child) when user clicks on button from
I have following code in button click Response.Write(window.open('Contact.aspx')); The above code is working.but if
I currently have a button when clicked it should open up a new window
I have other-window.xaml file and trying to open this from window.xaml on button click.
I have a button: <button>Click</button> I want click it and open a new window
I have opened a new window with JavaScript: var newwin = window.open('','preview','width=600,height=500'); Now I
i have popup-window in my script. I use window.open, but almost all browsers block
I have the following javascript: $('#ge-display').click(function (event) { window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no'); event.stopPropagation(); return false; }); the
I have a button that when clicked opens a Preferences window: -(IBAction)openPreferences:(id)sender { if
I have a pop up window function where when a button is clicked the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.