DOM Window Object methods
Window object methods
addEventListener(eventType, listener, useCapture)
Not supported in IE, which uses attachEvent() instead.
|Firefox/W3C only method that associates a function with a particular event and
binds the event to the current node.
EventType: A string representing the event to bind, without the
The advantage of using the DOM to bind an event is that you can
assign multiple functions to a node for the same event (ie:
Since listener must be a function reference, a common question is how to specify the listener so it can receive parameters of its own. The solution is just to wrap the listener in an anonymous function reference:
For events such as "
IE 5+only function
|IE5+ proprietary equivalent of addEventListener().
For the parameter eventType, the event string should include the "on"
prefix (ie: "onload", "onclick" etc).
IE 5+only function
|Removes an event handler and its function previously
associated with a node in IE5+, via attachEvent() for example. The
proprietary equivalent of DOM2's removeEventListener().
Not supported in IE, which uses fireEvent() instead.
|Dispatches an event to fire on a node artificially.
Firefox/W3C method. This method returns a Boolean indicating whether any of the
listeners which handled the event called preventDefault (false if
called, otherwise, true). IE's equivalent of dispatchEvent() is
<div id="test" onclick="alert('hi')">Sample DIV.</div>
Not supported in IE, which uses the "currentStyle" property instead.
|Firefox/W3C only method that returns a style
object containing the actual CSS property values added to an
element, whether they are set using inline CSS or global/external
stylesheets. To get the value to a specific cascaded CSS property,
you'd just look up that property within the returned object. Note
The following example shows how to retrieve
the value of the CSS property "
For more info, see: Getting global and external style sheet values in DHTML
|removeEventListener(eventType, listener, useCapture)||Removes the specified event from being binded to the
EventType: A string representing the event to unbind, without the
"on" prefix. For example, "click", "mousedown" etc.
|resizeBy(dx, dy)||Resizes a window by the specified amount in pixels.|
|resizeTo(x y)||Resizes a window to the specified pixel values.|
|scrollBy(dx, dy)||Scrolls a window by the specified amount in pixels.|
|scrollByLines(lines)||Scrolls the document by the number of lines entered as the parameter. NS/Firefox method.|
|scrollByPages(pages)||Scrolls the document by the number of pages entered as the parameter. NS/Firefox method.|
|scrollTo(x, y)||Scrolls a window to the specified pixel values.|
|sizeToContent()||Sizes the window to fit the content contained within. Useful, for example, with popup windows that contain small amounts of content. NS6/Firefox method.|
DD CSS Library
Free CSS menus and codes to give your site a visual boost.