All versions of the 1k DHTML API define two global variables (defining them globally takes up less space): d (a reference to the document object) and l (a boolean indicating if the browser is Netscape 4.x). If you redefine these variables in your own code, then the API will fail to work. So don't.
All versions of the 1k DHTML API (except subsets) define the following functions:
gE()gE(elementId)
elementIdThe id of an HTML element.
A reference to the named HTML element (even nested elements in NS4). This reference is used by the other functions.
gE() is short for "get element" and is the core method of the 1k DHTML API. In order to perform DHTML actions using the API on an HTML element, gE() must be called first to get a reference to the element. This reference is used as the first argument to any other function defined in the API.
sE()sE(elementReference)
elementReferenceThe reference to the HTML element returned by gE().
Nothing.
sE() is short for "show element" and sets the visibility CSS property to inherit. Note that this is different than visible which would mean that an element would become visible even if it's parent element is invisible. Instead, the visibility of the element will depend on it's parent's visibility (which is probably what you want 99% of the time).
hE()hE(elementReference)
elementReferenceThe reference to the HTML element returned by gE().
Nothing.
hE() is short for "hide element" and sets the visibility CSS property to hidden.
sZ()sZ(elementReference, zIndex)
elementReferenceThe reference to the HTML element returned by gE().
zIndexThe positive integer z-index value to assign to the element.
Nothing.
sZ() is short for "set z-index" and sets the z-index CSS property to the specified value. For cross-browser consistence, use only positive integer values.
sX()sX(elementReference, leftPixels)
elementReferenceThe reference to the HTML element returned by gE().
leftPixelsThe new left position of the HTML element measured in the number of pixels from the left edge of the positioning parent to the left edge of the HTML element.
Nothing.
sX() is short for "set x position" and sets the left CSS property to the specified value assuming a length measurement of pixels. This is measured with respect to the left edge of the HTML element's positioning parent. The positioning parent is the nearest parent with its position css property set to absolute or relative. If there are no such parents, the document is used as the positioning parent (ie, top and left are measured from the top-left corner of the document).
sY()sY(elementReference, topPixels)
elementReferenceThe reference to the HTML element returned by gE().
topPixelsThe new top position of the HTML element measured in the number of pixels from the top edge of the positioning parent to the top edge of the HTML element.
Nothing.
sY() is short for "set y position" and sets the top CSS property to the specified value assuming a length measurement of pixels. This is measured with respect to the top edge of the HTML element's positioning parent. The positioning parent is the nearest parent with its position css property set to absolute or relative. If there are no such parents, the document is used as the positioning parent (ie, top and left are measured from the top-left corner of the document).
sW()sW(elementReference, widthPixels)
elementReferenceThe reference to the HTML element returned by gE().
widthPixelsThe new width of the HTML element measured in pixels.
Nothing.
sW() is short for "set width" and sets the width CSS property to the specified number of pixels.
sH()sH(elementReference, heightPixels)
elementReferenceThe reference to the HTML element returned by gE().
heightPixelsThe new height of the HTML element measured in pixels.
Nothing.
sH() is short for "set height" and sets the height CSS property to the specified number of pixels.
sC()sC(elementReference, topPixels, rightPixels, bottomPixels, leftPixels)
elementReferenceThe reference to the HTML element returned by gE().
topPixelsThe top position of the clipping on the HTML element measured in pixels.
rightPixelsThe right position of the clipping on the HTML element measured in pixels.
bottomPixelsThe bottom position of the clipping on the HTML element measured in pixels.
leftPixelsThe left position of the clipping on the HTML element measured in pixels.
Nothing.
sC() is short for "set clip" and sets the clip CSS property to the specified values in the format rect(topPixelspx rightPixelspx bottomPixelspx leftPixelspx). Not supported in IE4.0 Mac and Opera 6 and below.
wH()wH(elementReference, newContents)
elementReferenceThe reference to the HTML element returned by gE().
newContentsThe new HTML content of the HTML element as a string.
Nothing.
wH() is short for "write HTML" and clears the current content of the element and replaces it with new HTML content. Buggy in IE4.x Mac. Not supported in Opera 6 and below.
This script is released under a Creative Commons License.