These days, many web-based applications are trying to look more like desktop applications. To a limited extent, it works -- until you come to dialog boxes. A desktop application's dialog box works one way, and the dialog boxes you can get from an opened web page work another way; they do not provide the same functions. Fortunately, there's a way to change this. This first part of a five-part article series gets you on your way.
Producing Web Page Dialog Boxes - The Main Method to Use (Page 2 of 4 )
The HTML DOM has a window object which has properties and methods to control and open windows. One of these methods has the following syntax:
open(URL,name,specs,replace)
All four parameters of this function are optional. This is the main function (method) we shall use in this series.
If, into a JavaScript, you type without arguments,
window.open()
a new window will open. Because there are no arguments, the opened window comes with a title bar, a menu bar, a tool bar, an address bar and a links bar. You should see “about:blank” as the title and as the content of the address bar. Dialog boxes usually have only the title bar; they do not have the other bars. Later in this series you will see how we get rid of these bars.
The URL Parameter
If you want the new window to be a web page from some server, then type the URL in quotes at this position.
The name Parameter
This is the name of the window. It is the target attribute. From a different dialog box, you can send the web page of some web site to a particular dialog box (window) on your screen; you need this parameter for that. We shall see how to do that.
The specs Parameter
This parameter takes the arguments for some of the presentation (size, position, etc.) aspects of the window. It is a comma-separated list of items. We shall cover this in great detail later.
The replace Parameter
This is used to decide whether a new window (dialog box) is opened as a new browser window, or if it will fit in the same browser window. We shall not use this much. However, I will comment on this at the end of the series.