Web hosting ratings - 162 Part III .Document Objects Reference You do

162 Part III .Document Objects Reference You do not have to use this method for most collision or event detection, however. The eventobject s srcElement property returns a reference to whatever object receives the event. Example (with Listing 15-24) on the CD-ROM Related Item: event object. contains(elementObjectReference) Returns: Boolean. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The contains() method reports whether the current object contains another known object within its HTML containment hierarchy. Note that this is not geographical collision detection of overlapping elements, but rather the determination of whether one element is nested somewhere within another. The scope of the contains() method extends as deeply within the current object s hierarchy as is necessary to locate the object. In essence, the contains() method examines all of the elements that are part of an element s allarray. Therefore, you can use this method as a shortcut replacement for a forloop that examines each nested element of a container for the existence of a specific element. The parameter to the contains() method is a reference to an object. If you have only the element s ID as a string to go by, you can use the document.all.item() method to generate a valid reference to the nested element. If the parameter is a reference to an element that has the same ID as another within the scope of the method, a script error results because a reference to such an element returns an array of elements rather than a valid object reference. An element always contains itself. Example on the CD-ROM Related Items: item(), document.getElementById() methods. On the CD-ROM Note On the CD-ROM elementObject.contains()
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Leave a Reply