Name

Library xbDOM — Cross Browser DOM API with support for Gecko based browsers, Internet Explorer 4+, Opera 5+, Netscape Navigator 4.x.

Synopsis


HTMLElement xbGetElementById(String sId, Window windowRef);
Array xbGetElementsByName(String sName, Window WindowRef);
Array xbGetElementsByNameAndType(String sName, String sType, Window WindowRef);
Number xbGetPageScrollX(Window windowRef);
Number xbGetPageScrollY(Window windowRef);
Number xbGetWindowHeight(Window windowRef);
Number xbGetWindowWidth(Window windowRef);
xbSetInnerHTML(HTMLElement element, String sHtml);
Number xbToInt(String sValue);

    

Source

xbDOM.js

Uses:  nothing

Description

xbDOM.js is a JavaScript Library that is used to provide cross browser functionality for basic operations in a cross browser fashion. Netscape Navigator 4.x, Gecko based browsers such as Netscape 6.x, Internet Explorer 4+ and Opera 5+ are supported.

Cross Browser Support

Browser Sniffing.  DOM based browser sniffing is used whereever possible to allow any standards compliant browser to support xbDOM.js. Please note that due to a bug in Netscape Navigator 4, it is sometimes necessary to include an empty script block before any scripts are referenced via the src attribute. This will make sure that Netscape Navigator 4 properly initializes the document.layers object which is used in detecting Netscape Navigator 4 via object sniffing.

Example

Example 1. Basic Example

Functions

xbGetElementById(String sId, Window windowRef)

returns a reference to the HTMLElement in the specified window with the specified ID.

Arguments: 

  • String ID of Element to be found.
  • Window reference to window where the Element resides. If not specified, defaults to current window.

Returns: HTMLElement if one exists with the specified ID, null otherwise.

xbGetElementsByName(String sName, Window windowRef)

Arguments: 

  • String ID of Element to be found.
  • Window reference to window where the Element resides. If not specified, defaults to current window.

Returns: Array of HTMLElements with name attribute matching

xbGetElementsByNameAndType(String sName, String sType, Window windowRef)

Arguments: 

  • String ID of Element to be found.
  • String name of Array in document object containing the item to be found.

    Supported Values

    • images
    • forms
    • anchors
    • links - returns empty list for Navigator 4.x
    • applets
    • embeds
  • Window reference to window where the Element resides. If not specified, defaults to current window.

Returns: Array of HTMLElements of the specified type with name attribute matching

xbGetPageScrollX(Window windowRef)

Arguments: 

  • Window reference to window where the Element resides. If not specified, defaults to current window.

Returns: Number horizontal scroll position of current window in pixels

xbGetPageScrollY(Window windowRef)

Arguments: 

  • Window reference to window where the Element resides. If not specified, defaults to current window.

Returns: Number vertical scroll position of current window in pixels

xbGetWindowHeight(Window windowRef)

Arguments: Window reference to the Window to be measured. If not specified, defaults to current window.

Returns: Number height of referenced window in pixels"

xbGetWindowWidth(Window windowRef)

Arguments: Window reference to the Window to be measured. If not specified, defaults to current window.

Returns: Number width of referenced window in pixels"

xbSetInnerHTML(HTMLElement element, String sHtml)

Arguments: 

  • HTMLElement to have contents set.
  • String containing HTML

Returns: Nothing

Support. Gecko, Netscape Navigator 4+, Internet Explorer 4+

Number xbToInt(String sValue)

Arguments: String to be converted to a number.

Returns: Number in base 10. If the String is not a valid number, 0 is returned.

Support. Gecko, Netscape Navigator 4+, Internet Explorer 4+, Opera