Introducing DOCJSLIB 3.0, How to Write Application - Doc JavaScript | WebReference

Introducing DOCJSLIB 3.0, How to Write Application - Doc JavaScript


Writing Applications with DOCJSLIB 3.0

The principles of writing applications with DOCJSLIB stay the same as with previous versions. The main idea of DOCJSLIB is that you can focus on your application rather than the nuts and bolts of cross-browser basic utilities. Since these utilities are common to many applications, there is no need to write them over and over again, but rather use them from a common library, DOCJSLIB. Using DOCJSLIB's functions, your application size will be short, clear, easy to maintain, and very easy to program.

Version 3.0 adds the Linked Image Model. This model is simpler than the Clicked Image from Version 2.0. With the Clicked Image, you have to write the event handler function. If the only event you are looking for is opening a URL upon clicking an image, then the Linked Image is the model you should use. You initialize the Linked Image by calling the makeLinkedImage() function. You manage this element, as in previous versions, through its ID. You can use any string to identify an element. Besides its ID, you can specify the image's GIF file, the URL of the link, the alternative textual representation, the image's width and height, its position on the window, its visibility, and its Z index. If you specify the visibility to be false, you will not see the element until its visibility is turned back on. The Z index lets you specify the third dimension. Elements with higher Z index cover elements with lower Z index.

Version 3.0 adds also the ability to call a function repeatedly, every a fixed-time interval. Call this function (doThisCommandEveryIntervalMS()) if you want a command or a function to be executed every a fixed-time interval. You will find this function very useful when you write utilities that constantly check for user-triggered changes in the browser. These changes might be window size changes, scrolling of the page, etc. The new window and page scrolling functions can help you in detecting these changes in a simple, cross-browser manner.

Once you create your elements with functions such as makeLinkedImage(), you have a wealth of functions for manipulating them. You can change their position on the page, their visibility, their Z index, etc. Now you can also compute the highest Z index of the page by the findHighestZ() function.

https://www.internet.com


Created: November 9, 1998
Revised: November 9, 1998

URL: https://www.webreference.com/js/column29/application