
JavaScript New Window Open / Close Buttons
The following script opens up a new window with the following size attributes:
width=400 height=200
Below is a list of the attributes you can use:
- width=300
Use this to define the width of the new window. - height=200
Use this to define the height of the new window. - resizable=yes or no
Use this to control whether or not you want the user to be able to resize the window. - scrollbars=yes or no
This lets you decide whether or not to have scrollbars on the window. - toolbar=yes or no
Whether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.). - location=yes or no
Whether or not you wish to show the location box with the current url (The place to type http://address). - directories=yes or no
Whether or not the window should show the extra buttons. (what's cool, personal buttons, etc...). - status=yes or no
Whether or not to show the window status bar at the bottom of the window. - menubar=yes or no
Whether or not to show the menus at the top of the window (File, Edit, etc...). - copyhistory=yes or no
Whether or not to copy the old browser window's history list to the new window.
Example
Script Source
<The New Window Button Script >
<FORM>
<INPUT type="button" value="New Window!" onClick="window.open('http://www.your_new_window_location_here','mywindow','width=400,height=200')">
</FORM>
<The Close Window Button Script >
<FORM>
<INPUT type="button" value="Click Here To Close The Window! " onClick="window.close()">
</FORM>
Please let me know if this script was helpful to you.
[rating]