Posts Tagged ‘window.open’
JavaScript window.open method
Posted December 29, 2008
on:To open a new window by clicking on the link, you will need to use window.open method of javascript.
Example:
<a href="javascript: void(0)" onclick="window.open('http://nazare.50webs.com', 'windowname', 'width=200, height=77'); return false;">Click here for simple popup window</a>
Now you can open a simple window, also this function can have different features of that window to appear.
Feature List:
Property | Default value | Description |
---|---|---|
width | auto | specifies width of the new window in pixels |
height | auto | height of the window in pixels |
top | auto | specifies window position |
left | auto | specifies window position |
directories | no | should the directories bar be shown? (Links bar) |
location | no | specifies the presence of the location bar |
resizable | no | specifies whether the window can be resized. |
menubar | no | specifies the presence of the menu bar |
toolbar | no | specifies the presence of the toolbar |
scrollbars | no | specifies the presence of the scrollbars |
status | no | specifies the presence of the statusbar |
To close the window just use window.close() or use window.close(‘windowname’) the name of the window which you have opened.