Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Opening Linked Windows with JavaScript 569

20


TABLE 20.4 Settings for Pop-Up Windows


Setting Purpose


height Height of the window in pixels.


width Width of the window in pixels.


resizable Enable window resizing.


scrollbars Display scrollbars.


status Display the browser status bar.


toolbar Display the browser toolbar.


location Display the browser’s location bar.


menubar Display the browser’s menu bar (not applicable on Mac OS X).


left Left coordinate of the new window onscreen (in pixels). By default, pop-up
windows are placed slightly to the right of the spawning window.


top Top coordinate of the new window onscreen (in pixels). By default, pop-up
windows are placed slightly below the top of the spawning window.


When you specify the settings for a window, you must include them in a comma-
separated list, with no spaces anywhere. For the settings that allow you to enable or
disable a browser interface component, the valid values are on or off. Here’s a valid list
of settings:


status=off,toolbar=off,location=off,left=200,top=100,width=300,height=300


Here’s an invalid list of settings:


status=off, toolbar=off, location=false, top=100


Including spaces (or carriage returns) anywhere in your list will cause problems. It’s also
worth noting that when you provide settings for a new window, the browser automati-
cally assumes a default of off for any on/off settings that you don’t include. So, you can
leave out anything you want to turn off.


Here’s a complete example that uses JavaScript to create a new window:


<!DOCTYPE html>




Popup example


Popup Example



Launch popup

Free download pdf