<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  url="/toolbox/examples/2002/xb/xbDOM/" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en"
  >

 <nde:header>

   <nde:title>
      Library xbDOM
   </nde:title>

   <nde:category>
     Manpage
   </nde:category>

  <nde:pubdate year="2002" month="04" day="21" />
  <nde:moddate year="2002" month="07" day="22" />

  <nde:summary>
      Cross Browser DOM API with support for 
      Gecko based browsers, 
      Internet Explorer 4+,
      Opera 5+,
      Netscape Navigator 4.x. 
  </nde:summary>

  <nde:authlist>
    <nde:author>
      <nde:authname>Bob Clary</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
  </nde:authlist>

  <nde:channels>
    <nde:channel id="examples"/>
    <nde:channel id="xb-2002"/>
  </nde:channels>

</nde:header>


 <nde:head>
 </nde:head>

 <nde:content>
   <h2>Synopis</h2>
   <pre><![CDATA[
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);
]]></pre>

    <h2>Source</h2>
    <p>
      <a href="xbDOM.js">xbDOM.js</a>
    </p>

    <h2>Uses</h2>
    <ul>
      <li>nothing</li>
    </ul>

    <h2>See Also</h2>
    
    <ul>
      <li>
        <a href="/toolbox/examples/2002/xb/xbStyle/">xbStyle</a>
      </li>
    </ul>

    <h2>Description</h2>
    <p>
      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.
    </p>
      
      <h3>Cross Browser Support</h3>
      <p>
        <h4>Browser Sniffing</h4>
        <p>
        DOM based browser sniffing is used whereever possible to allow any standards
        compliant browser to support xbDOM.js.
        </p>

        <p>
          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.
        </p>
      </p>

    <h2>Example</h2>

      <h3>Download</h3>
      <p>
        <a href="examples/xbDOM-examples.zip">xbDOM-examples.zip</a>
      </p>

    <p>
      <ul><li><a href="examples/">Basic Example</a></li></ul>
    </p>


    <h2>Functions</h2>
    <dl>
        <dt>xbGetElementById(String sId, Window windowRef)</dt>
        <dd>
          <p>returns a reference to the HTMLElement in the specified window with the specified ID.</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              <ul>
                <li>String ID of Element to be found.
            </li>
                <li>Window reference to window where the Element resides. If not specified, defaults
            to current window.
            </li>
              </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>HTMLElement if one exists with the specified ID, null otherwise.
            </p>
          </p>
        </dd>
        <dt>xbGetElementsByName(String sName, Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>
              <ul>
                <li>String ID of Element to be found.
            </li>
                <li>Window reference to window where the Element resides. If not specified, defaults
            to current window.
            </li>
              </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Array of HTMLElements with name attribute matching</p>
          </p>
        </dd>
        <dt>xbGetElementsByNameAndType(String sName, String sType, Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>
              <ul>
                <li>String ID of Element to be found.
            </li>
            <li>String name of Array in document object containing the item to be found.
              <p>Supported Values</p>
              <ul>
                <li>images</li>
                <li>forms</li>
                <li>anchors</li>
                <li>links - returns empty list for Navigator 4.x</li>
                <li>applets</li>
                <li>embeds</li>
              </ul>
            </li>
                <li>Window reference to window where the Element resides. If not specified, defaults
            to current window.
            </li>
              </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Array of HTMLElements of the specified type with name attribute matching</p>
          </p>
        </dd>
        <dt>xbGetPageScrollX(Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>
              <ul>
                <li>Window reference to window where the Element resides. If not specified, defaults
            to current window.
            </li>
              </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Number horizontal scroll position of current window in pixels</p>
          </p>
        </dd>
        <dt>xbGetPageScrollY(Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>
              <ul>
                <li>Window reference to window where the Element resides. If not specified, defaults
            to current window.
            </li>
              </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Number vertical scroll position of current window in pixels</p>
          </p>
        </dd>
        <dt>xbGetWindowHeight(Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>Window reference to the Window to be measured. If not specified, defaults to 
              current window.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Number height of referenced window in pixels&quot;
            </p>
          </p>
        </dd>
        <dt>xbGetWindowWidth(Window windowRef)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>Window reference to the Window to be measured. If not specified, defaults to 
              current window.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Number width of referenced window in pixels&quot;</p>
          </p>
        </dd>
        <dt>xbSetInnerHTML(HTMLElement element, String sHtml)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>
            <ul>
              <li>HTMLElement to have contents set.</li>
              <li>String containing HTML</li>
            </ul>
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Nothing
            </p>
          </p>
          <p>
            <h3>Support</h3>
            <p>Gecko, Netscape Navigator 4+, Internet Explorer 4+</p>
          </p>
        </dd>
        <dt>Number xbToInt(String sValue)</dt>
        <dd>
          <p>
            <h3>Arguments:</h3>
            <p>String to be converted to a number.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>Number in base 10. If the String is not a valid number, 0 is returned.
            </p>
          </p>
          <p>
            <h3>Support</h3>
            <p>Gecko, Netscape Navigator 4+, Internet Explorer 4+, Opera</p>
          </p>
        </dd>
    </dl>
 </nde:content>

<nde:related area="nde">
  <nde:item url="/toolbox/examples/2002/xb/">More xbAPI Examples</nde:item>
</nde:related>

</nde:article>
