Function-generated Popup Content with the
overlibmws DHTML Popup Library
 
maintained by Foteos Macrides at Macrides Web Services
Discuss these examples, seek help, and offer suggestions for
FUNCTION support via the
overlibmws Support Group.

 
This link has an example of the FUNCTION command.  The function gets today's date.  The call for this example is:
onmouseover="return overlib(FUNCTION,TodayIs,
 CAPTION,'Today\'s Date',CGCLASS,'olcg',
 CAPTIONFONTCLASS,'olcap',TEXTPADDING,4,TEXTFONTCLASS,'oltxt',
 WRAP,BASE,2,OFFSETX,-5,OFFSETY,20,AUTOSTATUSCAP,
 FGBACKGROUND,'../image/paper.jpg');
onmouseout="nd();"
where the parameter is a function reference.  That is, it is the name of a javascript function on your page which returns a string value.  The parens could be included, i.e., FUNCTION, TodayIs(), and are normally included for functions which take arguments, e.g., FUNCTION, Func(arg1,arg2,arg3).

This feature is implemented via the overlibmws_function.js plugin module, which should be imported after the overlibmws.js core module via a script block in the head section:
    <script type="text/javascript" src="overlibmws_function.js"></script>

The example uses the following script (in a script block) for getting today's date, and style sheet (in a style block) for the popup:
<script type="text/javascript">
 <!--
 function TodayIs()
 {
  thedow = new Array("Sunday","Monday","Tuesday","Wednesday",
                     "Thursday","Friday","Saturday");
  themoy = new Array("January","February","March","April","May","June","July",
                     "August","September","October","November","December");

  thedate = new Date();

  var txt = '';
  txt += '<div align="center">';
  txt += (thedow[thedate.getDay()] + ' ');
  txt += (themoy[thedate.getMonth()] + ' ');
  txt += (thedate.getDate() + ', ');
  if (thedate.getYear() > 1000) {
   txt += thedate.getYear();
  } else {
   if (thedate.getYear() > 90 && thedate.getYear() < 100) {
    txt += ('19' + thedate.getYear());
   } else {
    if (thedate.getYear() > 99)       	
     txt += (thedate.getYear() + 1900);       
   }
  }
  txt += '</div>';
  return txt;
 }
 // -->
</script>
 
<style type="text/css">
<!--
.olcg {background-color:#aa00aa; text-align:center;}

.olcap {
 font-family:Times New Roman,Verdana;
 font-size:12px;
 font-weight:bold;
 color:#ffffff;}

.oltxt {
 font-family:Times New Roman,Verdana;
 font-size:16px;
 color:#aa00aa;}
-->
</style>

 
Note that such scripts also can be used for overlib popups simply by putting the function call (with parens) in the Lead Argument of the overlb call, rather than making it the parameter for the FUNCTION command:
onmouseover="return overlib('It\'s promptly at 4:00 pm today:'+TodayIs(),
 CAPTION,'When is it?',CGCLASS,'olcg',
 CAPTIONFONTCLASS,'olcap',TEXTPADDING,4,TEXTFONTCLASS,'oltxt',
 WRAP,BASE,2,AUTOSTATUSCAP,FGBACKGROUND,'../image/paper.jpg');
onmouseout="nd();"
 
These examples use overlibmws and its commands.


Copyright Foteos Macrides
  2002-2010.
  All rights reserved.