/* This example is from JavaScript: The Definitive Guide, 3rd Edition. That book and this example were Written by David Flanagan. They are Copyright (c) 1996, 1997, 1998 O'Reilly & Associates. This example is provided WITHOUT WARRANTY either expressed or implied. You may study, use, modify, and distribute it for any purpose, as long as this notice is retained.*/ /* * File: dynEl.js * Include with: * * This file defines the DynEl class, which provides a portable API * to many Dynamic HTML features. */ /* * This is the constructor function for DynEl objects. * The arguments are the following: * window: The Window object in which the dynamic element is to appear * id: The HTML ID for the dynamic element. Must be unique. * body: HTML text that constitutes the body of the dynamic element * left: The optional initial X-coordinate of the element * top: The optional initial Y-coordinate of the element * width: The optional width of the element * * This constructor outputs a style sheet into the current document. * This means that it can only be called from the
of the document * before any text has been output for display. */ function DynEl(o) { /* Remember some arguments for later.*/ this.layerWindow = o.layerWindow; this.children = o.children; this.id = o.id; this.body = (o.body)?(o.body):(''); this.left = o.left; this.top = o.top; this.width = o.width; this.parent = o.parent; this.bgColor = o.bgColor; this.categoryObj = o.categoryObj; this.zIndex = o.zIndex; this.visibility = o.visibility; }; /* * Now we define a bunch of methods for the DynEl class. * We define one set of methods if we are running in Navigator, and * another set of methods if we are running in Internet Explorer. * Note that the APIs of the methods are the same in both cases; it * is only the method bodies that change. In this way, we define * a portable API to the common DHTML functionality of the two browsers. */ /* First, define the Navigator methods.*/ if (navigator.appName.indexOf("Netscape") != -1) { DynEl.prototype.getOutput = function() { if (this.children){ for(i=0;i