Javascript popup

If you like to open a popup window through JavaScript then following code may be used:

<script type=”text/javascript”>
function popup()
{,’nameofthewindow’, ‘location=no,width=1000,height=800,status=no,toolbar=no,scrollbars=yes);

<a href=”javascript:void(0);” onClick=”popup(val); return false;”>Open Popup</a>
If you like to have the popup in middle of the screen then following code may be useful;

<script type=”text/javascript”>
function popup(val)
var w = 1000;
var h  = 800;
var left = (screen.width – w) / 2;
var top = (screen.height – h) / 4;,’nameofthewindow’, ‘location=no,width=1100,height=800,status=no,toolbar=no,scrollbars=yes,left=’+left+’,top=’+top);

You can leave the second parameter blank if you don’t want to give any name to the popup window.

Leave a Reply

Your email address will not be published. Required fields are marked *