|
||||||||||||||||||||
It's Not Just Help. . . So How Does It Work? HTML Topics & Templates CSS DHTML
Project File (.hhp) Contents File (.hhc) Merging Modular Files Accelerating Links Distribution & Installation HTML Help Resources on the Web |
Open Secondary Window Recipe
|
URL |
is a variable passed from the calling element to the function. This variable identifies the URL of the page displayed in the window; |
|
windowName |
is another variable passed from the calling element to the function. This variable supplies the name used to refer to the window in scripts; |
|
x,y |
describe the overall size of the secondary window in terms of the number of pixels in the height and width (respectively); |
|
menubar, scrollbars, toolbars |
are navigation elements displayed if the value is yes (the default) or not displayed if the value is no; |
|
resizable |
determines whether the user can change the window’s size (default=yes; may also =no); |
|
status |
is the message area at the bottom of the window; displayed if yes (the default), hidden if no. |
<P onClick="openWindow('url','windowName')">Click here to open a new window.</P>
As it stands, this recipe allows you to specify the URL and window name for each link. If you will always use the same window name, you could remove the variable windowName from the first line of the function, so that you pass only the URL as a variable: function openWindow(url). Then, within the body of the function, supply an actual name instead of using the windowName variable.
You can also open a new window directly from an event handler, without using a function at all. For example, to use a button to open a new window and show an animated demonstration of a process, you could include the following code:
<FORM><input type="button" value="Show Me How" onClick="window.open('url', 'windowName', 'height=x, width=y, menubar=yes, resizable=yes, scrollbars=yes, status=yes, toolbar=yes')"></FORM>
The components of the element handler have the same meaning as in the original function, except that url and windowName should be the actual URL and window name, rather than variable names.