please dont rip this site

The Window Object

Also:

The Window object is the top level object and represents the window of the browser. It is the parent of the objects below it in the hierarchy list.

Window objects are either the current window (if the browser is displaying only a single document), or those created with a window.open() method (where the name is specified in the code), or separate frames, if the document is laid out using a <FRAMESET> definition (where the windows are named in the <FRAME> element). As the Window object is the top level object in the object hierarchy and the existance of the current window is assumed, most Window properties need not be prefixed by Window. For example, the following two references are identical :

window.defaultStatus
defaultStatus

and would both return the default text of the status bar for the current window. NOTE : The only exception to this is the open() and close() methods, which require an explicit window. prefix (i.e. window.open() and window.close()). Windows can also be referenced by using the properties top, parent or name, where the name property is replaced with the actual window name (as specified in the window.open() code, or <FRAMESET>. The parent and top properties are exactly as those used in <A HREF="..." TARGET="..."> constructs if the windows are part of a frameset.

Window Properties
client
The client property reflects the Navigator Object and can be used to retrieve information about the browser client.

closed
The Internet Explorer 4.0 specific closed property has a read-only boolean value, which represents whether the referenced window is closed (closed=true) or not (closed=false).

defaultStatus
The defaultStatus property can be accessed to return or set the text to be shown in the status bar of the browser while the current document. The defaultStatus property is different to the status property in that the text is always shown in the status bar. As seen below, the status property can be used to temporarily alter the status bar text. Internet Explorer currently set this property as the default status text and so works as the status property.

dialogArguments
The dialogArguments property returns any arguments that were used when the referenced modal dialog window was created. Note that this property only applies to windows created with the showModalDialog method. For example, if the following is used to open a modal dialog window:

self.showModalDialog "dialog.htm", "Enter search string"

and dialog.htm contains a text box (with an ID attribute of txtSearch), then running:

txtSearch.value=window.dialogArguments

would put the text "Enter search string" into the text box.

dialogHeight
The Internet Explorer 4.0 specific dialogHeight property reflects the height of the referenced modal dialog window. It is set as one of the features in the showModalDialog method.

dialogLeft
The Internet Explorer 4.0 specific dialogLeft property reflects the horizontal offset of the referenced modal dialog window, relative to the left hand edge of the desktop. It is set as one of the features in the showModalDialog method.

dialogTop
The Internet Explorer 4.0 specific dialogTop property reflects the vertical offset of the referenced modal dialog window, relative to the top edge of the desktop. It is set as one of the features in the showModalDialog method.

dialogWidth
The Internet Explorer 4.0 specific dialogWidth property reflects the width of the referenced modal dialog window. It is set as one of the features in the showModalDialog method.

document
The document property references the The Document Object for the referenced window. The document object has properties that contain information about the current document being viewed in the browser window object. For example :

vColour=parent.document.bgColor

stores the background colour of the document in the current window's parent in the variable vColour.

event
The event property references the Event Object, through which key and mouse states/positions can be determined for any event that occurs. Note that the Event Objects supported by both Internet Explorer and Netscape are different. Details are given in the Event Object topic.

external
The Internet Explorer 4.0 specific external property can be used to reference the object model of applications that host Internet Explorer. Various properties, methods and events exposed by the host application would then be available to scripting in HTML documents being displayed in the Internet Explorer application inside the host. Two methods are inherent to the external property though:

addChannel
Presents a user with a dialog box allowing them to add a channel to their system, or modify its properties if the channel is already installed. The addChannel method takes the single argument of a URL which should be the complete URL of the CDF file that defines the channel. Note that Microsoft intend this function only for publishers pre-installing channels when re-distributing Internet Explorer 4.0. As with the Internet Client SDK, it's included here for completeness.
isSubscribed
Returns a boolean (i.e. true or false) value representing whether the user is currently subscribed to the channel referenced in the URL argument of the method. A scripting error will occur if the referenced channel is not in the same secondary domain (i.e. http://beta.htmlib.com/ and http://www.htmlib.com/ both have the same secondary domain) as the document calling the method.

For further information on channels and information on creating channels, download the Internet Client SDK from Microsoft.

frames
The frames property references the The Frames collection. When a document is a framed document, the individual frames are indexed, starting at 0. So, for example, to access the location object of the frame defined third in the <FRAME> definitions, the following could be used :

vLocation=window.frames(2).location

NOTE : The above example uses Visual Basic Script notation (i.e. '(' and ')') to denote the index. JavaScript functions require the use of square bracket ('[' and ']').

history
The history property is also an object in its own right, with properties and methods. For more information, see The History Object. It represents the browsers current history list (a list of recently visited sites).

innerHeight
The Netscape 4.0 specific innerHeight property returns a value representing the referenced windows viewing area height (i.e. not including toolbars, scrollbars etc), in pixels.

innerWidth
Like the innerHeight property, the The Netscape 4.0 specific innerWidth property returns a value representing the referenced windows viewing area width (i.e. not including toolbars, scrollbars etc.), in pixels.

length
The length property returns the number of frames in a window object (when used under the window object. The length property is common to many scriptable objects). For example :

vFrames=HelpWin.length

would store the number of frames in the window named HelpWin (which is either a single frame, or a window created using the window.open() method) in the variable vFrames.

location
The location property returns the URL of the window objects current document (because href is its default property). This is actually an object in its own right, with various properties. For more details, see the Location Object.

locationbar
In Netscape 4.0, the Window Object supports the locationbar property, which has a boolean property of visible. Setting:

window.locationbar.visible=false

would remove the referenced windows location bar. Note : This can only be done via a 'signed script'. For information on signed scripts, see Netscape DevEdge Online.

menubar
As with the locationbar property, the menubar property is Netscape 4.0 specific and can be used (by setting the visible property to false) to remove the menu bar of the navigator window. This too requires a signed script.

name
The name property represents the name of a window object. It is read-only (that is, script functions can interrogate window names, but can not define them dynamically)

navigator
The navigator property references the Navigator Object property. See that topic for information about the navigator object.

offscreenBuffering
When Internet Explorer 4.0 is downloading a page, it initially sets the offscreenBuffering property to a string value of "auto" and it decides whether offscreen buffering is necessary. This can be over-ridden in a script function, by explicitly setting the offscreenBuffering property to "true" or "false". Once it has been set (either way), it returns a boolean value, representing whether offscreen buffering if enabled or not.

opener
The opener property returns the name of the window that created the current window (via a window.open() event). It can be used with further object properties (such as location etc.) to access properties of the window/document that opened the current window, or methods such as close() to automatically close the window that created the current window. For example :

self.opener.close()

would automatically close the window that created the new window. Note that recent enhancements to Javascript means that the first window used (i.e. the first browser window) cannot be closed in a script without the user confirming this (a confirm? dialog box appears)

outerHeight
The Netscape 4.0 specific outerHeight property returns a value representing the referenced windows total height (i.e. including toolbars, scrollbars etc), in pixels.

outerWidth
The Netscape 4.0 specific outerWidth property returns a value representing the referenced windows total width (i.e. including toolbars, scrollbars etc), in pixels.

pageXOffset
The Netscape specific pageXOffset property reflects the difference between the current horizontal position in the page and the pages left-most edge. That is, as a page is scrolled horizontally, the pageXOffset will increase, or decrease, being 0 if the current viewing area is the left-most edge of the page. (Note : This is similar to Internet Explorers scrollLeft property, but the two are incompatible)

pageYOffset
Similar to the pageXOffset property, the pageYOffset property reflects the same difference (of current vertical positions) between the current viewing area and the top-most edge of the window. (Note : This is similar to Internet Explorers scrollTop property, but the two are incompatible)

parent
The parent object returns the current windows parent object if the current window is part of a frame set (if it isn't, then accessing the parent property returns the current window object, acting as the self property). For example :

vStrParentName=parent.name

would store the name property of the parent window of the current window in the variable vStrParentName.

personalbar
In Netscape 4.0, the Window Object supports the personalbar property, which has a boolean property of visible. Setting:

window.personalbar.visible=false

would remove the referenced windows 'personal bar'. Note : This can only be done via a 'signed script'. For information on signed scripts, see Netscape DevEdge Online.

returnValue
This Internet Explorer 4.0 specific property reflects the return value of a modal dialog window, created with the showModalDialog method.

screen
The Internet Explorer 4.0 specific screen property provides a reference to the Screen Object, for obtaining properties of the users current resolution etc.

scrollbars
Like the other Netscape 4.0 specific *bars properties, the scrollbars property has the boolean visible property, which can be used to remove the scroll bars from a window. Note that this can only be performed by a signed script.

self
The self property returns the window object of the current window. For example :

vStrStatus=self.status

stores the text in the current window's status bar in the variable vStrStatus.

status
As said above, the status property can be used to temporarily change the text displayed in the status bar of a browser window. It is commonly used to set the status bar text when the mouse is moved over links in a document, so that more explanatory text, instead of a URL is displayed. For example :

self.status="This goes to the HTMLib web site"

would set the text in the status bar to "This goes to the HTMLib web site". Note that when documents are presented in a frame based layout, windows don't share common access to the browsers status bar, so using self.status in any frame based document, may not have any effect, but accessing top.status would change the status bar text.

statusbar
Like the other Netscape 4.0 specific *bars properties, the statusbar property has the boolean visible property, which can be used to remove the status bars from a window. Note that this can only be performed by a signed script.

toolbar
Again, the Netscape 4.0 specific toolbar has the boolean visible property, which can remove the tool bar from the navigator window. As with the other *bar properties, this can only be performed by a signed script.

top
The top property returns the window object of the top-most browser window. For example :

vLocation=top.location

sets the vLocation variable to the complete URL of the document in the top-most browser window.

window
The window property is a synonym for the current window. Like self, it references the current window.

Window Methods
alert
The alert method can be used to display a message to the user. (Internet Explorer Visual Basic Script also allows the use of the MsgBox function to do the same, with more interaction options). For example :

alert "Hi there, welcome to my page"

would display the message "Hi there, welcome to my page" over the current window. (NOTE : As alert is a method of the window object (the top level object), it does not require the window. prefix.) Also note that the message string can be a text string, or a property of any existing object.

back
The Netscape 4.0 specific back method causes the referenced window to navigate back one URL in its history list. It's the same as if the user had pressed the 'Back' button, or the history object had been scripted to cause a jump back.

blur
This Netscape specific method can be used to forceably remove focus from a given window object. For example, suppose you have created a window (via window.open() code, called 'HelpWin'), the following :

HelpWin.blur()

would remove focus from the newly created window.

captureEvents
This Netscape 4.0 specific event can be used to set the a window (or Document) object to handle single, or various events that would otherwise be handled by different document elements. For example:

window.captureEvents( Event.Click | Event.DblClick)

sets up the window to capture all click and double-click events (onclick and ondblclick). Once a window has captured events, you then need to decide what happens with them. The various options are:

  1. Return true
    Whatever element received the event that was captured by the window event will perform its default action (i.e. an <A> element's default action is to navigate to the URL provided in its HREF attribute).
  2. Return false
    The default action of the element receiving the event will not occur (e.g. the link will not navigate to the URL)
  3. Call routeEvent method
    This causes JavaScript to search for other event handlers for the event. For example, the Document Object may have been trying to capture the event. Failing another object trying to capture the event, Javascript will look to the original intended target of the event, in order to decide what to do.
  4. Call the handleEvent method
    This will force another element/object (that can handle such an event) to handle it, normally by performing its default action.

clearInterval
The clearInterval method cancels a corresponding setInterval method (described below. The syntax is :

clearInterval (MyInterval)

clearTimeout
The clearTimeout method is used to clear a specified setTimeout method, by referencing it by the ID of the setTimeout method. For example, to clear the setTimeout given in the previous example, use the following code :

clearTimeout MyTimeOut

NOTE : both the setTimeout and clearTimeout do not need the window. prefix, as they are methods of the top level Window object.

close
The window.close() method closes the window specified in the window. prefix, which is required. Any window can be closed using this method, providing it is referenced either by its name property, or by parent, self or top. NOTE : From JavaScript 1.1 (as supported by Navigator 3.0 and above), the window.close() method only allows automatic closing of windows generated by a corresponding window.open() event. Attempting to close any other window will display a confirm dialog, prompting the user to choose whether the window is closed or not.

confirm
Similar to the alert method, the confirm method displays a message to the user, but offers basic "OK" and "Cancel" buttons. For example, the following code displays a confirmation message and if the user chooses OK, the browser goes to the HTMLib web site. If they choose Cancel, then nothing happens.

function leave()
{
if (confirm("Are you sure you want to visit the HTMLib web site?"))
{location.href= "http://subnet.virtual-pc.com/~le387818"}
}

disableExternalCapture
The Netscape 4.0 specific disableExternalCapture method allows a signed script to capture events in pages that have been loaded from different servers. For example, in a framed set-up, 'foreign' (i.e. not on the same server as the current document) pages can be loaded into a frame and a signed script can capture events on these pages. The disableExternalCapture method would be used to stop the capture of events from the 'foreign' pages. For more information on signed scripts, visit Netscape DevEdge Online

enableExternalCapture
As with the disableExternalCapture method described above, the enableExternalCapture method can be used to capture events on pages from different servers. It too requires a signed script. Visit the URL above for more details on script signing.

execScript
The Internet Explorer 4.0 specific execScript method can be used to execute script functions in a certain language.

find
This Netscape 4.0 specific method invokes the 'Find' window of the browser, allowing the user to search for any text in the current document. Its effect is as if the user had chosen the 'Find' command from the Edit menu.

focus
This Netscape specific method can be used to force the focus to any window object. For example, given that there is a window named 'HelpWin', the following function snippet :

HelpWin.focus()

would pass the focus to the newly created window named HelpWin.

forward
This Netscape 4.0 specific method forces the browser to navigate forwards one URL in the history list - it's equivalent to the user pressing the 'Forward' button, or history manipulation through the History Object.

handleEvent
The Netscape 4.0 specific handleEvent method can be used to force a different object in the document to handle an event. Note that the object in question must be able to handle the event normally for the handleEvent method to succeed. The handleEvent works with the captureEvents, releaseEvents and routeEvent methods.

home
This Netscape 4.0 specific method forces the browser to navigate to the URL designated as 'Home' in the browser settings. It's identical to the user pressing the browsers 'Home' button.

moveBy
The moveBy method can be used to re-position the Navigator window, relative to its current position. For example :

self.moveBy (50,200)

would move the current window 50 pixels to the right and 200 pixels down from its current position. ('self' is used above, but any valid reference to a window object is useable). Note that it is only possible to move a Netscape browser window off-screen in a signed script. See Netscape DevEdge Online for information on script signing.

moveTo
The moveTo can be used to move the Navigator window to a specific point on the screen, by moving the top-left corner of the Navigator to the position specified :

self.moveTo (50,200)

would move the window to the position 50,200 on the users screen. Again, note that it is only possible to move a Netscape browser window off-screen in a signed script. See Netscape DevEdge Online for information on script signing.

navigate
The Internet Explorer 4.0 specific navigate method is equivalent to setting the location.href property to a different value, in that it causes the browser to navigate to the URL specified. For example:

sel.navigate ("http://subnet.virtual-pc.com/~le387818")

Note : For Internet Explorer 4.0, this method is only available to Visual Basic Script.

open
The open method allows script functions to create new browser windows and load documents into them. It also allows control over the window's appearance and size. The basic syntax is :

Variable=window.open("URL", windowname, "window_appearance")

where URL is the URL of the document to be loaded into the new window, windowname is the name given to the new window (subsequently its name property (see above)) and window_appearance is a comma-delimited list setting the window features. The window features are boolean values (i.e. either '0' or '1', or 'no' or 'yes'). The features controllable are :

toolbar
Specifies whether the browser's toolbar is displayed or not.
location
Specifies whether the location bar (showing the current URL) of the browser is displayed or not.
directories
Specifies whether the Netscape directory buttons are displayed or not.
status
Specifies whether the browser status bar is displayed or not.
menubar
Specifies whether the browser's menu bar is displayed or not.
scrollbars
Specifies whether the window will allow scrollbars or not.
resizable
Specifies whether the new window is resiz(e)able or not.
width="pixels"
Specifies the width of the new window.
height="pixels"
Specifies the height of the new window.
top="pixels"
Specifies the top co-ordinate to display the new window. (Internet Explorer and Navigator 4.0 and above only)
left="pixels"
Specifies the left co-ordinate to display the window. (Internet Explorer and Navigator 4.0 and above only)
*outerWidth*="pixels"
(Navigator 4.0 specific) Specifies the outer width of the Navigator window, instead of the viewable area contained within.
*outerHeight*="pixels"
(Navigator 4.0 specific) Specifies the outer height of the Navigator window, instead of the viewable area contained within.
*innerHeight*="pixels"
(Navigator 4.0 specific) Specifies the inner height of the Navigator window - the viewable area contained within. (Note that this replaces the height window feature, which is maintained for backwards compatibility). To produce a new shorter narrower than 100 pixels requires a signed script.
*innerWidth*="pixels"
(Navigator 4.0 specific) Specifies the inner width of the Navigator window - the viewable area contained within. (Note that this replaces the width window feature, which is maintained for backwards compatibility) To produce a new window narrower than 100 pixels requires a signed script.
*alwaysRaised*="yes|no||1|0"
(Navigator 4.0 specific) Forces the new window to always remain above other windows, whether it has the focus or not (as certain Windows Help files are displayed - hence, it would be useful for a 'help' window helping users with web-based applications.) Note : This is a secure feature that can only be set in a signed script.
*alwaysLowered*="yes|no||1|0"
(Navigator 4.0 specific) Forces the new window to always remain below other windows, whether it has the focus or not. Note : This is a secure feature that can only be set in a signed script.
*dependent*="yes|no||1|0"
(Navigator 4.0 specific) Creates the new window as a child of the opening window, which will close when the parent window closes. Note that a dependent window does not show in the taskbar.
*hotkeys*="yes|no||1|0"
(Navigator 4.0 specific) If set to true, then most of the hotkeys in the new window (if it doesn't have a menu bar are disabled, apart from the security and quit keys. (HotKeys are key combinations to perform menu operations - e.g. Ctrl+F for the File menu etc.)
*screenX*="yes|no||1|0"
(Navigator 4.0 specific) screenX replaces left as the setting for the horizontal placement (in pixels) of the new window (relative to the left hand side of the screen). Note that to create a new window off screen requires a signed script.
*screenY*="yes|no||1|0"
(Navigator 4.0 specific) screenY replaces top as the setting for the vertical placement (in pixels) of the new window (relative to the top of the screen). Note that to create a new window off screen requires a signed script.
*z-lock*="yes|no||1|0"
(Navigator 4.0 specific) Creates a new window that never rises above other windows, even when activated. This is a secure feature that can only be set using a signed script.
**fullscreen**="yes|no||1|0"
(Internet Explorer specific) This window feature forces the newly opened window into whats known as 'kiosk mode', where the window takes the entire screen and displays with no toolbar or menubar. Care should be taken using this setting, as most users will not appreciate a new window being created that blocks their entire screen. Note : At the time of writing, Internet Explorer only responded to fullscreen=1|0.
**channelmode**="yes|no||1|0"
(Internet Explorer 4.0 specific) Creates a new window in 'channel' mode, displaying the window in theater mode, with the channel bar. Note : At the time of writing, Internet Explorer only responded to channelmode=1|0.

NOTE : The window features labelled above, with '*' characters are only supported in Javascript 1.2, as supported by Navigator 4.0 and above. To be sure that any Javascript functions using these extended features don't throw a scripting error (or produce unwanted results), make sure to version the LANGUAGE attribute of the <SCRIPT> appropriately and provide version specific scripts if necessary. For more information, see Versioning Javascript..

NOTE : When using Visual Basic Script, the parenthesis characters must not be used surrounding the various window.open methods. I.e., the method should be used as follows under Visual Basic Script :

window.open URL,"window_name","window_options"

Internet Explorer now fully supports (from 3.02) the previously Netscape specific format of the window.open method. For example :

WindowName=window.open (URL,"WindowName","window_options")

where WindowName can then be used to control the newly created window.

Note : Internet Explorer 4.0 supports an extra argument to the window.open method - the replace argument. For example:

WindowName=window.open("http://www.mysite.com/", "NewWin", "toolbar=no;...", "replace=true"

would cause the URL of the newly created window to over-write the URL of the creating window in the history list. Essentially, it's the same as the replace method of the Location Object, but for multiple windows.

The HTMLib Window Builder
Use the 'Window Builder' below to create a new window with whatever options you like (only the options supported by Internet Explorer 4.0 are included):

Note : Currently, Internet Explorer will allow you to create ludicrously small windows (1 x 1 pixel is even possible). So that you'll be able to actually do something with it, the Window Builder sets a minimum height and width for the new window. Also, pressing Alt&C will close the window while it has the focus.

A note about the top and left window options
top and left should be used with care when positioning new windows exactly (i.e. by pixel measurements) because you can not be sure of the users screen resolution (although Navigator 4.0 now provides screen resizing and moving methods (see below)). Also, be aware of a current limitation in the Internet Explorer 3.01 support of these window settings. If the document calling the window.open method is displayed singularly (i.e. not part of a frameset), then top and left behave as expected and can be used to set the position of the new window, (in pixel units) on the screen.
If the document calling the window.open method is a framed document (i.e. displayed in a frame), however, then it starts to get a little complicated. For some as yet unknown reason the top and left co-ordinates should be reversed, to display the newly created window in the right position. For example if the following code is executed in a non-framed document,

NewWin=window.open(URL,name,"left=640,top=480");

then the new window would be created at a position x=640 pixels and y=480 pixels. However, if the same code was executed from a framed document, then the new window would be created and displayed at x=480 y=640 pixels. For the same code to work, displaying the window in the same position, called from a framed document, the code would need to be :

NewWin=window.open(URL,name,"left=480,top=640");

Just to add to the confusion, Internet Explorer 3.02 seems to have permanently reversed the top and left settings (so that calling ...left=x1, top=y1 actually places the new window at a position x=y1, y=x1 pixels), regardless of whether the document utilising the window.open method is framed or single. Support of these two method attributes is basically a legacy of the previously supported 'Explorer' object, which was supported in the Windows 95/NT4 v3.01 of Internet Explorer, but removed from v3.02 for security reasons.

NOTE : The top and left attributes are not officially documented as being supported by Internet Explorer, so should be used with care as their support may possibly change without notice.

print
This Netscape 4.0 specific method prints the document in the referenced window or frame, using the default printing properties for the browser. Its effect is as if the user had pressed the 'Print' button on the browser. It would be courteous to give users an option to print documents, rather than automatically printing them from a script function.

prompt
Again, like the above two methods, the prompt method allows you to present the user with a dialog allowing them to enter values (like Visual Basic Script's InputBox method). The method is called, defining a default value in the input box. For example, the following code asks the user to enter a year, giving 1996 as the default value.

prompt("Enter a year", 1996)

releaseEvents
The Netscape 4.0 specific releaseEvents method can be used to release events that had previously been captured using the captureEvents method. The syntax for releasing single, or multiple events is the same as for the captureEvents method.

resizeBy
As you'll probably have guessed, the resizeBy method resizes the window from its current size by the amounts specified. For example :

self.resizeBy (50,200)

would move the bottom right hand corner of the navigator window 50 pixels to the right and 200 pixels down, creating a larger window. Note that to resize a window to less than 100x100 pixels requires a signed script.

resizeTo
Like the moveTo method above, the resizeTo method can be used to resize the window to a specific size. For example :

self.resizeTo (640,480)

would resize the window to 640 by 480 pixels. Again, to resize a window to less than 100x100 pixels requires a signed script.

Be aware that you can not guarantee the viewers screen resolution, so regardless of the imposed restrictions, use these methods with caution. The sensible option would be to always use a moveTo method to set the window at the top-left corner of the users screen before performing any resizing methods, to ensure the entire viewing area is visible. Also limiting the maximum size of sites requiring this functionality to 640x480 pixels would also be sensible.

routeEvent
The Netscape 4.0 specific routeEvent method can be used to route an event that has been previously captured using the captureEvents method. It uses the following syntax:

objectReference.routeEvent(eventType)

for example:

document.BigLink.routeEvent(event.click)

would pass click events to the element whose ID property is BigLink

scroll
This specific method can be used to automatically move the user to any point in the current window. It is similar to mid page links, using <A HREF="#..."> constructs, except it moves the user to a position of pixel values, rather than links. For example :

HelpWin.scroll(200,300)

would scroll the user to the position 200,300 (in pixels). The number sequence is x-coordinate, y-coordinate.

scrollBy
As with the other *By methods, the scrollBy scrolls the viewing area of the window by the amounts specified in the values. For example :

self.scrollBy (50,100)

would scroll the viewing window 50 pixels to the left and 100 pixels down. Scrolling to the right would only be effective is there is content currently off the screen (for example, you may have layers currently off-screen, or very wide images).

scrollTo
This method scrolls the viewing window to an exact pixel position, given by the values. For example :

self.scrollTo (100,300)

scrolls to the point 100 pixels to the right and 300 pixels down.

Note : scrollTo extends the scroll method (see above), which is still supported in Navigator 4.0 and above for backwards compatibility.

setInterval
The setInterval method can be used to either call a Javascript function, or evaluate an expression, after a specified time interval (in millisecond) has expired. For example :

setInterval=MyInterval (startanim(),1000,20,100)

would execute the function startanim(), after 1 second has elapsed (1000 milliseconds), passing it 20 and 100 as arguments to the function. Any number of arguments can be passed in the setInterval method (i.e. as many as are required by the function). The setInterval method will repeatedly call the referenced function, or expression, until the user leaves the document that contains the script. This is essentially the only difference between it and the setTimeout method, which is only executed once, after the specified time interval.

setTimeout
The setTimeout method can be used to execute a script function, or access any existing object property or method, after a specified time interval. For example, the following code section would execute the script function TooMuchTime() after 5 seconds :

MyTimeOut=setTimeout ("TooMuchTime()", 5000)

The time interval is always specified in milliseconds.
In Javascript 1.2 (as supported by Navigator 4.0 and above), the setTimeout method can be used to evaluate an expression, as well as calling functions. Note that this will require using LANGUAGE="Javascript1.2" in the <SCRIPT> element, so as to prevent older browsers throwing a scripting error, or not functioning as expected.

showHelp
The Internet Explorer 4.0 specific showHelp method creates an instance of the HtmlHelp window, passing it the URL given as an argument to the method. For example:

self.showHelp "help.htm"

would load help.htm into a newly created HtmlHelp window. Note that HtmlHelp windows are children of the window that creates them, so the HtmlHelp window will close down when the window that created it is closed

Pressing this button demonstrates the showHelp method :

showModalDialog
The Internet Explorer 4.0 specific showModalDialog method can be used to create a modal dialog window. This is a special window that does not release the focus back to the window that created it until it is closed, preventing the user from switching back to the main document until they have satisfied the requirements of the modal dialog window (or closed it).

The showModalDialog method is:

Variant = object.showModalDialog(URL [, arguments [, features]])

where:

URL
represents the location of the file to open in the dialog.
arguments
can be a string value specifying some arguments for the opening window. I.e. initialisation values etc.
features
allows setting of the decoration for the dialog, covering the following:
feature name Description
dialogWidth Initial dialog width, in pixels
dialogHeight Initial dialog height, in pixels
dialogTop Initial vertical offset, in pixels
dialogLeft Initial horizontal offset, in pixels
center A boolean (yes|no|0|1) value describing whether to automatically centre the dialog in the screen
font Specifies font settings, according to the font Style Sheet property (see Font properties for more information.
font-family Specifies font family, according to the font-family Style Sheet property (see Font properties for more information.
font-size Specifies font size, according to the font-size Style Sheet property (see Font properties for more information.
font-weight Specifies font weight (boldness), according to the font-weight Style Sheet property (see Font properties for more information.
font-style Specifies font style settings, according to the font-style Style Sheet property (see Font properties for more information.
font-variant Specifies font variant, according to the font-variant Style Sheet property (see Font properties for more information.
border Specifies the border width (thick|think)
help A boolean value setting whether to show the '?' button to the title bar
minimize A boolean value setting whether to show the minimise button to the title bar
maximize A boolean value setting whether to show the maximise button to the title bar

Note : At the time of writing, Internet Explorer 4.0 modal dialogs would lose their 'modality' if the file loaded caused a scripting error.

stop
This Netscape 4.0 specific method causes downloading of the page to stop, as if the user had pressed the 'Stop' button on the browser.

A note about window references for the positioning/moving methods
For the moveBy, moveTo, resizeBy and resizeTo methods, the whole navigator window is moved or resized. This means that if the methods are invoked in a framed document, then the entire Navigator window is altered, regardless of the window reference (providing that it is valid). I.e. using 'top', 'self' and 'parent', or referencing any framed document currently in the same Navigator display window all have the same effect. Single documents, or separate windows (created from links, or the open method) can be referenced by their name.
For the scrollBy and scrollTo methods, all windows (framed or otherwise) can be manipulated by using a valid reference. However, if the window referenced doesn't contain sufficient content for scrollbars to be necessary, then both these methods will do nothing.

Window Events
Internet Explorer 4.0 only supports the onHelp Standard Dynamic HTML events. Netscape supports some of these events for the Window Object. See the standard Dynamic HTML events for details. Additionally, the following events are supported:

OnBeforeUnload
This Internet Explorer 4.0 specific event fired before the onunload event (see below). It has been added with Data Binding, to allow data to be updated prior to the page being unloaded.

OnBlur
This event handler can be used in <BODY> and <FRAMESET> elements, as well as for the Window object. It is fired whenever the user removes focus from the referenced window object. For extra details, see the <BODY> and <FRAMESET> topics.

OnDragDrop
The Netscape 4.0 specific OnDragDrop event for the window object occurs when the user attempts to drag and drop an object (typically an HTML document) onto the current window. Using various Event Object for Netscape, it's possible to perform script functions whenever the user drops an object on the navigator window.

OnError
This event handler can be used in <BODY> and <FRAMESET> elements, as well as the more general Window object and is fired when an error occurs for the window, for example, the document doesn't load, or a script error occurs.

OnFocus
This event handler can be used in <BODY> and <FRAMESET> elements as well as the general window object and is fired whenever the user focuses on the referenced window. For exact details, see those topics. OnLoad
The OnLoad event can be used in window objects. It is generally used in the <BODY> element, or <FRAMESET> elements (Netscape only) and executes functions when the document (framed or normal) has finished loading. For information about this event, see the relevant element topics.

OnMove
This Netscape 4.0 specific event is fired whenever a MoveBy or MoveTo method (see above) is used on any valid Window Object, or the user moves the referenced window.

OnResize
This Internet Explorer 4.0 specific event is fired whenever the user resizes the referenced window. Content that is sized according to the users viewing window could be resized when this event fires for example.

OnScroll
The Internet Explorer 4.0 specific onScroll event is fired whenever the user scrolls in the referenced window.

OnUnLoad
The opposite of the above event, the OnUnLoad event is used to execute script functions when the user exits a window object (a frame window, or a normal window). It is also used only in the <BODY> and <FRAMESET> elements (supported in both elements, by both browsers). For details, see those topics.

See:


file: /Techref/language/html/ib/Scripting_Reference/windo.htm, 59KB, , updated: 2021/2/5 17:44, local time: 2024/11/15 03:52,
TOP NEW HELP FIND: 
3.15.231.182:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/Techref/language/html/ib/Scripting_Reference/windo.htm"> The Window object</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .