Accessing information about and making changes to an element within the web page that is identified by an id is made significantly easier when you use the $O object. Simply specifying tst = new $O('test'); (where 'test' is the id of the element) creates a 'tst' object which provides the following properties containing information about the element and methods allowing us to change the element.
Properties
==========
obj - is a pointer to the DOM object that this JavaScript object is connected to
width - the width of the DOM object in pixels
height - the height of the DOM object in pixels
left - the distance from the left of the page to the left edge of the DOM object in pixels
right - the distance from the left of the page to the right edge of the DOM object in pixels
top - the distance from the top of the page to the top edge of the DOM object in pixels
bottom - the distance from the top of the page to the bottom edge of the DOM object in pixels
layer - the z-index of the object relative to its container
visibility - identifies whether the DOM object is visible or hidden
Methods
=======
setVisibility(v) - allows visibility to be set to visible or hidden
toggleVisibility() - hides the DOM object if visible or makes it visible if hidden
moveto(x,y) - moves the DOM object so that the top, left of the object is at the specified coordinates (as long as the object isn't position:static)
moveby(x,y) - moves the DOM object by the specified distance down and right (as long as the object isn't position:static)
moveLayer(z) - specifies a new z-index value for the element relative to its container.
|