Pop Up Windows
Page 2
First, an example:
| Sonnets can be written in several different forms, the two most common being Shakespearian and Petrarchan. (Click the links for more info on each form.) However, one definite rule is that sonnets must consist of 14 lines, each line usually being written in iambic pentameter. |
Now, here's the code:
<a href="javascript:void(0)" onclick="window.open('shakespearian.html', 'info','toolbar=0,location=0,status=0,menubar=0,resizable=1,scrolling=1, width=200,height=200'); return false;">Shakespearian</a>
Now here's what it means:
<a href="javascript:void(0)" onclick="window.open - This tells the browser that we're opening a link (HREF command) and that we're going to do it when the link is clicked, i.e. "onclick".
shakespearian.html - The name of the document we want to load in the window.
info - The anchor name of the window we're opening (NOT what will be displayed as the title). This is useful if we want interaction between the main page and the pop-up. Or say our viewer leaves the Shakespearian window open and then clicks the Petrarchan link, the Petrarchan page will load into the same window as the Shakespearian one, as they both have the same anchor name. If you want different links to open new windows, give them different names.
Now we come to the window features:
- toolbar
- location
- status
- menubar
- resizable
- scrolling
All these values are set to either 0 for false, or 1 for true. So in our example, the new window will not have a toolbar, location bar (where you type the URL in), status bar or menu bar, but it will be resizable, and it will allow scrolling.
The final two values are the width and height we want the window to have, which are set in pixels.
On the next page, you'll find some notes about using this function.
[Back] :: [Top] :: [Next]
|