Opening and closing a window  

The effect

The form

<form>
<input type="button" value="New window" 
onclick="window.open('popup_contents.html','fapopup','height=250,width=370,left=60,top=120,resizable=yes');">
</form> 

The parameters for window.open() are URL, name, features and replace. The "replace" parameter refers to the new window's behavior in the history list. In this case we have omitted it, and it defaults to false.

By not mentioning window features such as menubar, scrollbar and toolbar, we ensure they are turned off. The default value for such features is =no.

The [Close window] link
<a href="javascript:" onClick="window.close()">[Close window]</a>

Here we see another way to make a link that doesn't take us anywhere. In our rollover example, we used href="#" to make a link that only ran a script. Here we use href="javascript:", which is more elegant and informative.