September 18 2008

Controlling the size of the window when link is clicked

Here is a quick overview that will show you how to control the size of the window that opens using javascript.  There are other ways to do this, but this is a fairly simple and quick method.

In this piece of code you can change the variables:

  • height - must be a number - determines the height, in pixels, of the new window
  • width - must be a number - determins the width, in pixels, of the new window
  • linkname - must be text - name of the link
  • scrollbars - yes or no - controls placement of horizontal or vertical scrollbars

That’s it! Use that code and you will make a window open in a smaller window - not a pop up!  So you should have no problem with pop up blockers.