what is window object?
window features
object functions
Size: 79.97 KB
Language: en
Added: Apr 24, 2020
Slides: 8 pages
Slide Content
Window object A window object is a top level object for each document, location and history object Syntax: windowVar = window.open (“URL”, “window name”, ”window features”)
Window features Option Values Description 1. Height Integer Used to set the height of the new window 2. Width Integer Used to set the width of the new window 3. Location Yes/no or 1/0 Used to display/ hide the location bar in the new window 4. Resizable Yes/no or 1/0 If resizable is set to yes, window resizing can be done by users. By default window resizing is disabled 5. Menu bar Yes/no or 1/0 Used to display/hide the menu bar 6. Scrollbars Yes/no or 1/0 Used to display /hide scroll bars 7. Status Yes/no or 1/0 Used to display/hide status bar 8. Toolbar Yes/no or 1/0 Used to display/hide the tool bar
Window object property Property Description closed Returns a Boolean value indicating whether a window has been closed or not status Sets or returns the text in the status bar of a window defaultStatus Sets or returns the default text in the status bar of a window document Returns the Document object for the window frames Returns all frame elements in the current window history Returns the History object for the window length Returns the number of all frame elements in the current window location Returns the Location object for the window name Sets or returns the name of a window parent Returns the parent window of the current window
Window object functions Method Description alert() Displays an alert box with a message and an OK button confirm() Displays a dialog box with a message and an OK and a Cancel button prompt() Displays a dialog box that prompts the visitor for input open() Opens a new browser window close() Closes the current window scroll(x ,y) This method is used to move a window at a new position blur() Removes focus from the current window focus() Sets focus to the current window
The form object The form takes a number of attributes: Name : the name of the form Method : the method by which data is sent to server (get and post) Action: the URL of script to which data entered by the user will be sent. onsubmit : the form is submitted to the server. o nclick: the event is triggered when the user clicks on that element. o nreset: resets the form
The browser object Property Description appCodeName Returns the code name of the browser appName Returns the name of the browser appVersion Returns the version information of the browser language Returns the language of the browser platform Returns for which platform the browser is compiled
History object Property Description next Represents next page URL in the history object list, if any. Previous Represents previous page URL in the history object list, if any Current Represents current page URL in the history object list Length Property length returns the number of objects in the history list
Date object Method Description date() Returns the current date and time getDate() Returns the day of the month (from 1-31) getDay() Returns the day of the week (from 0-6) getMonth() Returns the month (from 0-11) getHours() Returns the hour (from 0-23) parse() Parses a date string and returns the number of milliseconds since January 1, 1970 setDate() Sets the day of the month of a date object setMonth() Sets the month of a date object setHours() Sets the hour of a date object toString() Converts a Date object to a string