Method | NS2 | NS3 | NS4 | NS6 | IE3a | IE3b | IE4 | IE5 | IE5.5 | IE6 |
alert | x | x | x | x | x | x | x | x | x | x |
| Returns: Nothing |
| Displays an alert box. Syntax: window.alert([ msg ]) , where msg is a string holding the message to display in the alert box. See "Alerts, Confirmations, and Prompts" in this chapter for an example. |
attachEvent | See Chapter 6, "Using Core HTML Methods and Events." |
back | | | x | x | | | | | | |
| Returns: Nothing |
| Navigates the Netscape Navigator back one page in the browser's history. Syntax: back() . Not available in the Internet Explorer, so for cross-browser compatibility, it's probably best to stick with the history object (see Chapter 10, "Using the navigator , location , and history Objects"). |
blur | See Chapter 6. |
captureEvents | | | x | | | | | | | |
| Returns: Nothing |
| Lets the window object capture events in Netscape navigator 4.0. Syntax: captureEvents( eventTypeList ) . Here, eventTypeList holds a list of events to capture, OR'ed together like this: Event.CLICK Event.MOUSEUP . See Chapter 15, "Working with the Mouse, Keyboard, and Images," for more details. |
clearInterval | | | x | x | | | x | x | x | x |
| Returns: Nothing |
| Clears an interval set with setInterval . (The interval sets the time between repeated automatic calls to the code you specify.) Syntax: clearInterval( intervalID ) , where intervalID is the ID returned by setInterval . See "Creating Timed Events" in this chapter for an example. |
clearTimeout | x | x | x | x | x | x | x | x | x | x |
| Returns: Nothing |
| Clears a timer set with setTimeout and stops it from calling your code at some time in the future. Syntax: clearTimeout( timerID ) , where timerID is the ID returned by setTimer . See "Creating Timed Events" in this chapter for an example. |
close | x | x | x | x | x | x | x | x | x | x |
| Returns: Nothing |
| Closes a window. Syntax: close() . See "Opening and Closing New Windows " for an example. |
confirm | x | x | x | x | x | x | x | x | x | x |
| Returns: Boolean |
| Displays a confirmation dialog box that displays a message as well as OK and Cancel buttons . Syntax: window.confirm([ msg ]) , where msg is the message to display. See "Alerts, Confirmations, and Prompts" in this chapter for an example. |
createPopup | | | | | | | | | x | x |
| Returns: Popup object |
| Creates a popup window, which is typically used for dialog boxes, message boxes, tooltips, and other temporary windows. Syntax: createPopup() . (This method can actually take a parameter, but that parameter is not used in the current versions of the Internet Explorer). See "Creating Popups" in this chapter for an example. |
detachEvent | See Chapter 6. |
disableExternal- | | | x | | | | | | | |
Capture | Returns: Nothing |
| Disables event capture in other frames in the Netscape Navigator 4.0. See Chapter 15 for more on this topic. |
enableExternal | | | x | | | | | | | |
Capture | Returns: Nothing |
| Enables event capture in other frames in the Netscape Navigator 4.0. See Chapter 15 for more on this topic. |
execScript | | | | | | | x | x | x | x |
| Returns: Nothing |
| Executes a script passed to the method as a string. Syntax: window.execScript( code, language ) , where code is the code to execute and language is the scripting language to use (allowed values: "JScript" the default "JavaScript" and "VBScript" ). Unlike the JavaScript eval function, this function does not return a result, although it does have access to the global variables in your script. Good when you want to execute some code in another scripting language, such as VBScript. |
find | | | x | | | | | | | |
| Returns: Boolean |
| This Netscape Navigator 4.0 method works like the Find dialog box in this browser. Syntax: find([ text [, caseSensitive [, searchUp ]]] ), where text is the text to search for, caseSensitive is a Boolean value indicating whether the search should be case-sensitive, and searchUp is a Boolean value indicating whether the search should search upward. Returns true if the text was found, false otherwise . |
fireEvent | See Chapter 6. |
focus | See Chapter 6. |
forward | | | | x | x | | | | | |
| Returns: Nothing |
| Navigates the Netscape Navigator forward one page in the browser's history. Syntax: forward() . Not available in the Internet Explorer, so for cross-browser compatibility, it's probably best to stick with the history object (see Chapter 10). |
getComputedStyle | | | | | x | | | | | |
| Returns: style object |
| Gets a computed style. Syntax: getComputedStyle( style ) . |
GetAttention | | | | x | | | | | | |
| Returns: Nothing |
| This Netscape Navigator 4.0 method gets the attention of the user if the browser is already not the topmost window. In Windows, for example, this method causes the browser's button in the taskbar to flash. The MacOS beeps and displays a bullet next to the browser's entry in the Application menu. Syntax: GetAttention() . |
getSelection | | | | | x | | | | | |
| Returns: String |
| Gets the text that is currently selected (highlighted) in a window. Syntax: window.getSelection() . Replaces the deprecated document.getSelection() (discussed in Chapter 9, "Using the Document and Body Objects"). |
handleEvent | | | x | | | | | | | |
| Returns: Nothing |
| This Netscape Navigator 4.0 method handles events captured with setCapture . Syntax: handleEvent( event ) , where event is an event type such as Event.CLICK . See Chapter 15 for more details. |
home | | | x | x | | | | | | |
| Returns: Nothing |
| Navigates the Netscape Navigator to the web page that's been set as the home page. Syntax: home() . |
moveBy | | | x | x | | | x | x | x | x |
| Returns: Nothing |
| Moves a window. Syntax: window.moveBy( iX , iY ) , where iX is the horizontal change in pixels and iY is the vertical change in pixels. See "Moving Windows" in this chapter for more details. |
moveTo | | | x | x | | | x | x | x | x |
| Returns: Nothing |
| Moves a window. Syntax: window.moveTo( iX , iY ) , where iX is the new horizontal position in pixels and iY is the new vertical position in pixels. See "Moving Windows" in this chapter for more details. |
navigate | | | | | x | x | x | x | x | x |
| Returns: Nothing |
| Navigates to a new URL. Syntax: navigate( URL ) , where URL is the URL to navigate to. For cross-browser compatibility, it's better to use window.location.href . |
open | x | x | x | x | x | x | x | x | x | x |
| Returns: window object or null |
| Opens a new browser window. This is a big onesee "Opening and Closing New Windows" in this chapter for the details and syntax. |
print | | | x | x | | | | x | x | x |
| Returns: Nothing |
| Prints a window. Syntax: print() . Note that Netscape Navigator 4.0 for Windows prints only the current frame. Netscape Navigator 6.0 enables you to print all frames. Internet Explorer gives you the option of printing all frames or a specific frame. See "Printing" in this chapter for an example. |
prompt | x | x | x | x | x | x | x | x | x | x |
| Returns: Text or null |
| Displays a prompt box and returns user-entered text. Syntax: window.prompt([ msg ] [, defaultValue ]) , where msg is the prompt to display to the user and defaultValue is the text that originally appears in the prompt's text field. If the user enters text and clicks OK (not Cancel), this method returns the entered text. See "Alerts, Confirmations, and Prompts" for an example. |
releaseEvents | | | x | | | | | | | |
| Returns: Nothing |
| This Netscape Navigator method releases event capture. Syntax: releaseEvents( eventTypeList ) . Here, eventTypeList holds a list of events to release, OR'ed together like this: Event.CLICK Event.MOUSEUP . See Chapter 15 for more details. |
resizeBy | | | x | x | | | x | x | x | x |
| Returns: Nothing |
| Resizes the browser window. Syntax: window.resizeBy( iX , iY ) , where iX is the change in horizontal size in pixels and iY is the change in vertical size in pixels. |
resizeTo | | | x | x | | | x | x | x | x |
| Returns: Nothing |
| Resizes the browser window. Syntax: window.resizeTo( iX , iY ) , where iX is the new horizontal size in pixels and iY is the new vertical size in pixels. |
routeEvent | | | x | | | | | | | |
| Returns: Nothing |
| If you've turned on event capture in Netscape Navigator 4.0, this method enables you to route an event after you have worked on the event and want to pass it along to the next event handler. Syntax: routeEvent( event ) . See Chapter 15 for more details. |
scroll | | x | x | x | | | x | x | x | x |
| Returns: Nothing |
| Scrolls a window. Syntax: window.scroll( hCoordinate , vCoordinate ) , where hCoordinate is the new horizontal position in pixels and vCoordinate is the new vertical position in pixels. This method has been gradually replaced by scrollTo , but is still available. See "Scrolling a Window" in this chapter for more details. |
scrollBy | | | x | x | x | | | x | x | x |
| Returns: Nothing |
| Scrolls a window. Syntax: window.scrollBy( hCoordinate , vCoordinate ) , where hCoordinate is the horizontal change in pixels and vCoordinate is the vertical change in pixels. See "Scrolling a Window" in this chapter. |
scrollByLines | | | | x | | | | | | |
| Scrolls a window by a number of lines. |
| Syntax: window.scrollBy( lines ) , where lines is the number of lines to scroll by. See "Scrolling a Window" in this chapter. |
scrollByPages | | | | x | | | | | | |
| Scrolls a window by a number of pages. |
| Syntax: window.scrollBy( pages ) , where pages is the number of pages to scroll by. See "Scrolling a Window" in this chapter. |
scrollTo | | | x | x | x | | | x | x | x |
| Returns: Nothing |
| Scrolls a window. Syntax: window.scrollTo( hCoordinate , vCoordinate ) , where hCoordinate is the new horizontal position in pixels and vCoordinate is the new vertical position in pixels. See "Scrolling a Window" in this chapter. |
setActive | See Chapter 6 |
setCursor | | | | x | | | | | | |
| Returns: Nothing |
| Sets the cursor in Netscape Navigator 4.0. |
| Syntax: setCursor( type ) , where type can be one of: alias, auto, cell , context-menu , copy, count-down, count-up, count- up-down , crosshair, default, e-resize, grab, grabbing , help, move, n-resize, ne-resize, nw-resize, pointer, s-resize, se-resize, spinning, sw-resize, text, w-resize, or wait. |
setInterval | | | x | x | | | x | x | x | x |
| Returns: Interval ID value (integer) |
| Sets an interval to use to call a function or execute code repeatedly. Syntax: window.setInterval( code , milliSeconds [, language ]) . Here are the arguments: code is code that specifies a function or text string of code to be executed when the specified interval has elapsed, milliSeconds is an integer that specifies the number of milliseconds between executions, and language is a string that specifies any one of the possible values for the LANGUAGE attribute. (The Netscape Navigator does not support the language argument.) Returns an ID value to use with clearInterval . See "Creating Timed Events" in this chapter for an example. |
setTimeout | x | x | x | x | x | x | x | x | x | x |
| Returns: ID value |
| Sets an interval to use to call a function or execute code at some time in the future. Syntax: window.setTimeout( code , milliSeconds [, language ]) . Here are the arguments: code is the code that specifies a function or text string of code to be executed when the specified time has elapsed, milliSeconds is an integer that specifies the number of milliseconds to wait until execution, and language is a string that specifies any one of the possible values for the LANGUAGE attribute. (The Netscape Navigator does not support the language argument.) Returns an ID value to use with clearTimeout . See "Creating Timed Events" in this chapter for an example. |
showHelp | | | | | | | x | x | x | x |
| Returns: Nothing |
| This Internet Explorer method enables you to display a WinHelp window for Windows .hlp files. Syntax: window.showHelp( URL [, ContextID ]) , where URL specifies the URL of the file to be displayed as help, and ContextID specifies a string or integer that indicates a context identifier in a Help file. |
showModalDialog | | | | | | | x | x | x | x |
| Returns: Nothing |
| Displays a modal dialog box. This is a big onesee "Dialog Boxes" in this chapter for the syntax and details. |
showModelessDialog | x | x | x | x | x | x | x | x | x | x |
| Returns: Nothing |
| Displays a modeless dialog box. This is a big onesee "Dialog Boxes" in this chapter for the syntax and details. |
sizeToContent | | | | x | | | | | | |
| Returns: Nothing |
| Resizes a window so that all the window's contents are visible. |
| Syntax: sizeToContent() . |
stop | | | x | x | | | | | | |
| Returns: Nothing |
| Using this method is the same as clicking the Stop button in the Netscape Navigator's toolbar. Syntax: stop() . |