[ Back to Pikes Peak Perl Mongers Home page ]

This is the JavaScript used at this site to simulate balloon hints. It was obtained from http://gocho.pm.org/majorcool/ and customized by tbchambers at yahoo dot com (tbc). Insert it directly after the <html> tag and before the <head> tag.

          <SCRIPT LANGUAGE="JavaScript">
          <!-- Hide Script from Ill-Behaved Browsers

          //--------------------------------------------------------------------
          // Tool Tip/Balloon Help: dynamic mouseOver/mouseOut windowing
          //
          //  o Shows/hides text in pop-up window.
          //
          //  o Delayed open to only pop those who pause for help.
          //
          //  o mouseOut->mouseOver will re-use open window rather than
          //    than close & reopen.
          //
          //  o Window closes after timeout. Timeout varies with amount
          //    of text displayed. More text, larger timeout.
          //
          //  o Harmless to non-compliant browsers.
          //
          // Known bugs:
          //
          //  o No control of window.open() placement.
          //
          //  o In Win MSIE3.x: if tipWin is closed manually, the object
          //    is still valid but the window is not open. The timeout
          //    of the tip will result in 'scripting error 80010012'.
          //    Luckily, other browsers support onMouseOut, so the problem
          //    is not widespread.
          // 
          //--------------------------------------------------------------------
          // Bill Houle                         NCR Corporation
          // bhoule@conveyanced.com             bill.houle@sandiegoca.ncr.com
          //--------------------------------------------------------------------

          // Global settings; tweak as required
          //
          tipTitle = "Pikes Peak Perl Mongers link description";
          tipBgColor = "#000080";               // or Post-It yellow #FFFF80
          tipFgColor = "#FFFFFF";
          tipWidth = 400;
          tipHeight = 50;
          // Timing
          tipOpen = 100;                        // open msecs after mouseover
          tipClose = 500;                       // close msecs after mouseout
          tipFactor = 10;                       // est: chars read in 1 msec
          // Null defaults
          tipWin = null;
          tipOTime = null; tipOFlag = 0;
          tipCTime = null; tipCFlag = 0;

          //--------------------------------------------------------------------
          // tip(tipLocation, tipText, later)
          //      tipLocation -- handle:  a Window name
          //      tipText -- string:      the message to display in tipLocation
          //                              null string to close tipLocation
          //      later -- boolean:       show text immediately or after pause
          //
          // Usage:
          //      onMouseOver='tip(win,"This is descriptive.",1); return true;'
          //      onMouseOut='tip(win,"",0); return true;'
          //      onClick='tip(win,"",0); return true;'
          //
          //   o  Don't forget the onClick(), or else the tip window may pop
          //      up while you are off doing whatever the click action was.
          //
          function tip(tipLocation, tipText, later) {
                  window.status = tipText; // my customization (tbc)
                  //
                  // Clear any pending window opens or closes. Please note:
                  //   uninitialized "timeout id" in NN3.x is untestable 'opaque'
                  //   object, while "timeout id" in MSIE *must* be tested before
                  //   clearTimeout(). Therefore, use global integers to bypass
                  //   this Catch-22 situation.
                  //
                  if (tipOFlag != 0) { clearTimeout(tipOTime); tipOFlag = 0; }
                  if (tipCFlag != 0) { clearTimeout(tipCTime); tipCFlag = 0; }
                  //
                  // Remove the tip from display
                  //
                  if (tipText == '') {
                          if (tipWin == null) return;     // already gone
                          //
                          // Close window in the future (extra delay is to
                          //   avoid popping down & up if there is a subsequent
                          //   mouseOver).
                          //
                          tipCTime = window.setTimeout(
                                  "if (tipWin != null) {tipWin.close(); tipWin=null;}",
                                   tipClose);
                          tipCFlag = 1;
                  }
                  //
                  // Display the tip
                  //
                  else {
                          //
                          // If not yet open and requesting delayed open...
                          //
                          if (tipWin == null && later > 0) {
                                  tipOTime = window.setTimeout(
                                          "tip('"+tipLocation+"','"+tipText+"',0);",
                                          tipOpen);
                                  tipOFlag = 1;
                                  return;
                          }
                          //
                          // MSIE requires explicit options on open(). Also,
                          //   contrary to appearances, this double open is not
                          //   for the known NN2 open() bug (which ignores the
                          //   location URL), but rather for an IE3 problem that
                          //   creates a window object without a valid document
                          //   object within.
                          // The 'dependent' attribute is Netscapism to indicate
                          //   a window child relationship.
                          //
                          tipWin = window.open("",tipLocation,
                                  "width="+tipWidth+",height="+tipHeight+","+
                                  "toolbar=0,menubar=0,scrollbars=0,"+
                                  "location=0,status=0,resizable=0,"+
                                  "directories=0,dependent=1");
                          tipWin = window.open("",tipLocation,
                                  "width="+tipWidth+",height="+tipHeight+","+
                                  "toolbar=0,menubar=0,scrollbars=0,"+
                                  "location=0,status=0,resizable=0,"+
                                  "directories=0,dependent=1");
                          if (tipWin == null) return;      // whoops!
                          // bring window to front
                          if (parseInt(navigator.appVersion) > 2) tipWin.focus();
                          if (tipWin.document) {
                                  tipWin.document.open('text/html');
                                  tipWin.document.write("<HEAD><TITLE>");
                                  tipWin.document.write(tipTitle);
                                  tipWin.document.write("</TITLE></HEAD>");
                                  tipWin.document.write("<BODY BGCOLOR='"+tipBgColor+"' TEXT='"+tipFgColor+"'>");
                                  tipWin.document.write("<P><FONT SIZE=2>");
                                  tipWin.document.write(tipText.bold());
                                  // this is a total kludge to work around server blindly looking for </BODY> (tbc)
                                  tipWin.document.write("</FONT></"+"BODY>");
                                  tipWin.document.close();
                          }
                          else if (tipWin) {
                                  // open window, but still no document?!?
                                  tipWin.close();
                                   return;
                          }
                          //
                          // Estimate how long it takes to read this much text;
                          //   blank the tip text after a suitable delay for
                          //   reading.
                          //
                          tipRead = Math.round(tipText.length/tipFactor) * 1000;
                          tipOTime = window.setTimeout(
                                    "tip('"+tipLocation+"','',0);",
                                    tipRead);
                          tipOFlag = 1;
                  }
          }

          //====================================================================
          // End of JavaScript -->
          </SCRIPT>

        

[ Back to Pikes Peak Perl Mongers Home page ]