THE
1k
DHTML
API






Visibility
Visible

Position
x:
y:

Size
w:
h:

Clipping
t:
l:
b:
r:
 

Change contents

Download script
(win: shift-click)
(mac: option-click)

The 1k DHTML API is a fully-functional, cross-browser (4+ browsers in Win, Mac and Linux) DHTML script that weighs 971 bytes. It can be made smaller by removing functions that aren't need. Email me if you do something neat with it.

The following table documents the 1k DHTML API functions. Argument types are indicated by 'i' (integer) or 's' (string) following argument descriptions.

NameUsageDescription
gE()
(Get Element)
gE(i)
i - Element id (s)
Returns a reference to the named element (even nested elements in NS4). This reference is used by the other functions.
sE()
(Show Element)
sE(e)
e - Element ref.
Makes the element visible.
hE()
(Hide Element)
hE(e)
e - Element ref.
Makes the element invisible.
sZ()
(Set Z-index)
sZ(e,z)
e - Element ref.
z - New z-index (i)
Assigns a new z-index to the element.
sX()
(Set X)
sX(e,x)
e - Element ref.
x - New x-coord (i)
Changes the element's horizontal position.
sY()
(Set Y)
sY(e,y)
e - Element ref.
y - New y-coord (i)
Changes the element's vertical position.
sW()
(Set Width)
sW(e,w)
e - Element ref.
w - New width (i)
Changes the element's width.
sH()
(Set Height)
sH(e,h)
e - Element ref.
w - New height (i)
Changes the element's height.
sC()
(Set Clip)
sC(e,t,r,b,l)
e - Element ref.
t - New top clip (i)
r - New right clip (i)
b - New bottom clip (i)
l - New left clip (i)
Changes the element's clipping values. Not supported in Opera and IE4.0 Mac.
wH()
(Write HTML)
wH(e,h)
e - Element ref.
h - New HTML content (s)
Writes new content to the element erasing the old content. Buggy in IE4.x Mac. Not supported in Opera.

The script uses 7 variables: 'd' (reference to the 'document' object), 'l' and 'op' (booleans indicating if the browser is Netscape 4.x or Opera respectively), and 'V', 'W', 'X' and 'Y' (local variables).

Visit the 1k DHTML API homepage.