1k DHTML API - Description

The 1k DHTML API is a fully-functional, cross-browser DHTML API that weighs in at about 1k. The script provides functions that set an element's visibility, z-index, x and y coordinates, width and height, and clipping. I've also thrown in one that can write new HTML content into the element. The script supports NS4+, IE4+, Mozilla, Opera 4+ and any other browsers that support either W3C standards, the IE DOM, or the NS4.x DOM.

There are two versions of the script: a standards-compliant script that will work in all supported browsers including Mozilla in standards mode (1021 bytes) and the original script that won't work in Mozilla unless it's in quirks mode (971 bytes). Both define the same functions and behave identically so I've combined the discussion of both. The downloadable zip includes both versions.

This script started as an entry in the 5k contest. The script struck a chord and people started to write extensions for the 1k DHTML API. I also received super-compressed versions of the script. I've made all of the variants, subsets, and extensions available here. However, since the API's release in 2001, my development interests have evolved and I no longer develop DHTML for NS4.x (which was the original reason I wrote the it). So I don't maintain this script any more and these pages are mostly for historical interest (though it may still be helpful for some).

Because it is intended to be as light as possible, the script has no error checking or recovery functionality. Despite this limitation, it behaves rather well. Perhaps the only errors you might encounter are:

"d.getElementById is not a function" in NS4.x

Caused by calling gE() with an invalid id value.

"e.style is null or not an object" or "e.innerHTML is null or not an object" in IE4+.

Caused by calling any function after calling gE() with an invalid id value.

Script Engine / Document Object Model Required

( Javascript 1.2 | JScript 3.0 | ECMAScript 1.0 ) & ( Nescape 4 DOM | IE 4 DOM | DOM 1 )

Modification History

2001/04/19

Posted.

2001/04/19

Revised original script - now 971 bytes.

2001/04/19

Added standards-mode compliant version.

More about this script

Related to this script

Licensing

This script is released under a Creative Commons License.