Setting the Features of Web Page Dialog Boxes - Size and Position
(Page 2 of 4 )
Size of the Dialog Box
Here I will tell you how to give size to the dialog box and how to resize the dialog box.
To resize, you have to use the specs parameter of the open() method. The following code will produce a window whose width is 400px and whose height is also 400px.
window.open("","","menubar=no,toolbar=no,width=400,height=400","")
Note the ‘width=400’ and ‘height=400’ arguments. You do not have to include the “px” unit designation next to the value.
This size is given when you are opening (creating) the dialog box.
Position of the Dialog Box
When you are creating a new dialog box, you can have its position set. The following code will set the new window at the position (25px, 25px) of the screen.
window.open("","","menubar=no,toolbar=no,width=400,height=400,left=25,top=25","")
The coordinates for position are the left and top coordinates. That is, the left-top corner of the new window is 25px left from the left edge of the screen and 25px down from the top of the screen.
Note the ‘left=25’ and ‘top=25’ arguments. You do not have to include the “px” unit designation next to the value.
Positioning a dialog box can be a good thing, but I usually do not code this. I usually allow the browser to choose a position for me. If you allow the browser to do this for you, it will choose a random position. In practice the random position is usually okay. Occasionally, if the user does not like the position he can drag the window (the title bar) to a position that suits him.
Next: Sending Content to the Dialog Box >>
More HTML Articles
More By Chrysanthus Forcha