Saturday, November 12, 2011

Javascript Popup Window

There are some cases we need to launch new popup window when user click a link or button. For example, when we want to show some privacy detail information when user clicks Privacy link. Typically this is done by Javascript and normally the popup window does not have toolbar, menu, scollbar and status bar.

So here is popup window inline javascript. It pops up a new window whose size is 470 x 150. return false statement is added at the end so that it keeps current window as well.

<a href="/Privacy.htm"
    onclick="javascript: window.open('/Privacy.htm','_blank',
          'resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,
           width=470,height=150', false); return false;">Privacy</a>

Of course, the Javascript can be placed to <Script> section in HEAD and simply calls the Javascript function in OnClick event.

No comments:

Post a Comment