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
Subscribe
Filter by APML