Create POPUP windows in JavaScript

In Javascript you can easily create popup windows by using window.open method.

window.open takes three parameters like URL for popup window, popup window name and height, width, location.. for popupwindow.

The code to create popup window look like below.

 
<html> <head> <title>popup page</title> <script type="text/javascript"> function winOpen() { var win1,win2; var left = (screen.width/2)-(800/2); var top = (screen.height/2)-(600/2); var winfeatures='width=800,height=600,scrollbars=0,location=0, resizable=0,top='+top+',left='+left + ',scrollbars=yes'; win1=window.open("window.html","window1",winfeatures) win1.focus(); } </script> </head> <body onload="javascript:winOpen();"> <div> <input type="button" value="Click For POPUP" onclick="winOpen();" /> </div> </body> </html>

Click the below button for popup.

I tested this with major browsers like firefox,IE ..., it works fine.
Download source code here

Recent Articles

CLR integartion in SQL Server
Create, Read and Write Files in .Net
Message Queue in .Net
Deploy Asp.Net Web Site
Queues in Vb.Net
If you have any queries or doubts post at Forum
Share on Facebook
Responses(post your response or comments below)
Name *

Email * (won't be published)

Response *