Window Opening

A new window can be opened with a new HTML document. We can use the 'onClick' attribute of the anchor tag to initiate this event.

We use a JavaScript command (window.open) to open the new window with various options:

dependent ties new window to current window – close current closes new
height pixel height of window
location  if yes includes location bar
menubar  creates menu bar at top of new window
directories  personal directory bar (what’s new…)
scrollbars  horizontal and vertical scrollbars
status  if yes, add browser status bar
toolbar  if yes, add browser toolbar
width  pixel width of window


Sample code for the link below:

<a HREF="something.html" TARGET="somewindow" onClick="window.open('something.html', 'somewindow', 'width=300, height=200 toolbar=no, status=yes');">Something</a>

Important note: do not forget the commas between elements such as width=300 height=200, if you neglect the comma the attribute may be ignored.

Link:

Something