home *** CD-ROM | disk | FTP | other *** search
- function com_netobjects_scrollBarComponent( params ) {
- this.statusScroll = seStatusScroll;
- this.display = display;
- this.clearStatusBar = ssClearStatusBar;
-
- this.name = (params.name+"" != "undefined" && params.name+"" != "" && params.name != null ? params.name : "scrollBarComponent1");
- this.tooltip = (params.tooltip+"" != "undefined" && params.tooltip != null ? params.tooltip : "");
- this.updateDuration = (params.updateDuration+"" != "undefined" && params.updateDuration != null ? params.updateDuration : 10);
- this.scrollRate = (params.scrollRate+"" != "undefined" && params.scrollRate != null ? params.scrollRate : 1);
- this.scrollMsg = (params.scrollMsg+"" != "undefined" && params.scrollMsg != null ? params.scrollMsg : "");
- this.scrollWidth = (params.scrollWidth+"" != "undefined" && params.scrollWidth != null ? params.scrollWidth : 200);
- this.scrollNewWidth = (params.scrollWidth+"" != "undefined" && params.scrollWidth != null ? params.scrollWidth : 200);
-
- function display() {
-
- window.status = this.tooltip;
- setTimeout(this.name + '.display();',this.updateDuration*1000);
- }
-
- function ssClearStatusBar() {
- window.status="";
- }
-
- /* ======================================================================
- FUNCTION: statusScroll
-
- INPUT: msg (string): the string to be displayed in the status bar
- width (integer): the number of spaces to appear between
- the left margin of the status bar and the
- message string, msg, when first displayed
- rate (integer): the number of milliseconds between scrolling
- intervals
-
- RETURNS: a handle to the timer;
- null if invalid parameters were entered.
-
- DESC: This function scrolls a user-defined message, msg, from right to
- left in the browser's status bar. The message is scrolled and
- refreshed at every interval specified by the rate parameter.
- Set the width parameter to determine how far from the left side
- of the status bar to start the scrolling message. The message
- will then scroll that many spaces from right to left until being
- "swallowed up" by the left margin, and repeat.
-
- The following example shows how to generate a scrolling message
- that will scroll 100 spaces from right to left, moving one
- space every 50 milliseconds:
-
- statusScroll("Welcome to my site!", 100, 50);
-
- PLATFORMS: Netscape Navigator 3.01 or higher,
- Microsoft Internet Explorer 3.02 or higher
- ====================================================================== */
- function seStatusScroll()
- {
- // Use the hidden 4th parameter to "save" the initial width during the multiple
- // iterations of the function. If it's not specified, as is the case when called
- // for the first time by the user, initialize it to the width param.
- var CWIDTH = this.scrollWidth;
- var width = this.scrollNewWidth;
-
- var ch = " ";
- var outputStr = "";
- var command = "";
-
- // Check validity of parameters
- if (this.scrollMsg+"" == "undefined" || this.scrollMsg == null)
- return null;
- if (width+"" == "undefined" || width == null)
- return null;
- if (this.scrollRate+"" == "undefined" || this.scrollRate == null)
- return null;
-
- // If the current width is greater than the initial width,
- // whittle it down.
- if (width > CWIDTH)
- width--;
- else if (width <= CWIDTH && width > 0) {
- // If the current width is less than the initial width,
- // but still greater than zero, the message is being
- // displayed between the status-bar boundaries.
-
- // Pad the msg string with spaces
- for (var i=0 ; i < width ; i++)
- outputStr+=" ";
- outputStr += this.scrollMsg;
-
- // Decrement the width to keep the string moving from right to left
- width--;
- }
- else if (width <= 0) {
- // If the width is less than zero, then the string is
- // being "swallowed up" but the left border of the
- // margin. Execute the code to swallow up one character
- // at a time.
- if (-width < this.scrollMsg.length) {
- outputStr += this.scrollMsg.substring(-width, this.scrollMsg.length);
- width--;
- }
- else {
- outputStr = " ";
- width = CWIDTH;
- }
- } // end else if (width <= 0)
-
- window.status = outputStr;
-
- // Set the timer to call this function with the newly decremented width
- // parameter. Continue to pass the msg and rate parameters. Also pass
- // the CWIDTH parameter so the original width is always known. This is
- // needed to continually loop through the sequence.
- this.scrollNewWidth = width;
- command = this.name + ".statusScroll()";
- scrollTimer = window.setTimeout(command, this.scrollRate*1000);
- return outputStr;
-
- } // end statusScroll
- }