Javascript: Pop-up window from a HTML link

HTML Javascript Pop-up window

Sometimes you may see the need to have a smaller sized window or browser when a user clicks on a link. This is helpful for Help Topics, Static Information, or just anything that doesn't need the full browser opened. You can also control the scrollbars, toolbar, status bar, location bar, width, height and location on the screen.

Javascript code

Below is the sample javascript code that needs to be placed between the <HEAD></HEAD> tags of your html document. The sample code generates another browser that is 350 pixels wide and 300 pixels heigh. It also allows the scrollbars to show if the content is larger than the window. It is also resizable, but has no Location or status bar.

<!--Hide script from old browsers
function newWindow(newContent)
winContent =, 'nextWin', 'right=10,top=20,width=350,height=300,toolbar=no,scrollbars=yes,resizable=yes,location=no,status=no')
//Stop hiding script from old browsers -->

HTML Link That Generates The Pop-Up

You will need to create a web page, popup.html, which would have the information that you want to display within the pop-up window.

<a href="javascript:newWindow('popup.html')" title="Click for Help">Click For Help</a>

More by this Author

  • Tips For How to Stain Concrete Floors

    You don't always have to tile, carpet, or hardwood your floors. The new thing is to just stain the concrete that's already there. It's a lot of work, but if done properly, your home will look gorgeous. If you're...

  • How to Get Rid of Mice In and Around The House?

    Until this year, the only time that I've had mice or rats in the house were when my daughter had pet mice and rats, and one of those times we did have one loose in the house. (Science fair project got loose.) Anyway,...

  • How to Build Wooden Roof Trusses

    You may refer to a truss as the rafter, but it's basically the skeleton of the roof, carrying the weight of the frame and supporting the walls of the building. Trusses are very important to preventing the walls from...

Click to Rate This Article