Home Javascript Javascriptexamples JavaScript Open Modal Window



JavaScript Open Modal Window
Posted on: April 18, 2011 at 12:00 AM
This page discusses - JavaScript Open Modal Window

JavaScript Open Modal Window

        

In this section, you will learn how to open Modal window in JavaScript.

As we have already discussed about the window.open() method of Window object which is used to open a new window. It lets the user interact with both of the windows i.e. original window and new opened window. Here we are going to open a popup window which remains in front of the original window and does not allow any user to communicate with the original window until the new window is closed. This can be done by using the method showModalDialog() of the window object.

Here is the code:

<html>
<h2>Open Modal Window</h2>
<script anguage="JavaScript"> 
function openWindow(){
window.showModalDialog("http://www.roseindia.net");
}
</script>
<button onclick="openWindow();">Click Here to Open Modal Window</button> 
</html>

Output will be displayed as:

On clicking the button, a new window will get open which does not allow the user to interact with the original window until the new window has closed.

Download Source code:

 

        

Related Tags for JavaScript Open Modal Window:


More Tutorials from this section

Ask Questions?    Discuss: JavaScript Open Modal Window  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.