Re: What is the meaning of the DOM ECMAScript binding?

 --- Jesse McCarthy <mccarthy36@earthlink.net> wrote: > "Joseph Kesselman"
<keshlam@us.ibm.com> wrote on 11/8/01 6:16:29 PM:
> >
> >The DOM is an API, not a set of specific variables. It expressed absolutely
> >no opinion on what your variable are called; it just says that if you have
> >an object which presents the Document interface, it will have thus-and-such
> >methods and properties and behaviors.
> >
> >If you want to assign a Document to a variable that you call custardPudding
> >-- assuming that the datatype of the variable is such that it will accept a
> >Document -- that's entirely your choice -- just as you can name your
> >integer variables anything you please.
> >
> >> If the purpose of the  binding is not to establish actual object names,
> >>then I don't see what purpose it would serve.
> >
> >It isn't. It establishes the methods and behaviors of those objects once
> >you've obtained them. How you obtain them is out of the DOM's scope.
> 
> 
> I see your point.  That leads me to my next question (I don't know if this is
> 
> in your sphere of interest).  I am  a web developer, seeking to use the DOM 
> with ECMAScript to author scripts that will function in any browser that 
> complies with the standards for DOM, ECMAScript, and whatever version of HTML
> --
>  without any monkey business to find out what browser it is or do anything to
> 
>  accomodate any particular browser.  Obviously the most fundamental interface
> 
>  that I will need to access is 'Document' or 'HTMLDocument'.  If different 
>  compliant implementations of the DOM can provide access to that interface by
> 
>  objects of different names, how am I supposed to accomplish my goal? 

Jesse,
I think you can rely on Navigator and Explorer to follow DOM, since they are
both involved in its conception. A bit of example code should illustrate how to
use the DOM API in NS, and IE:

var myDocument = window.document;  // Document object
var myNodeList = myDocument.getElementsByTagName( 'select' ); // NodeList
var myElement = document.getElementById( 'myId' );  // eg: <div
id='myId'></div>
var header = document.createElement( 'h2' );
var text = document.createTextNode( 'Hello There!' );
header.appendChild( text );
myElement.appendChild( header );

I hope this explains how to use DOM. Apologies for any bugs or bad practices ;)

Cheers, Neil


=====
+44 7866 462220           (mobile)
neil_laurance@yahoo.co.uk (mobile)
neil_laurance@adc.com     (work)

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Received on Friday, 9 November 2001 06:39:06 UTC