MenuPopup
PHP class that generates a DHTML Popup Menu
INSTALL
Download library and documentation libpopupmenu.zip ( 3166 bytes )
SYNOPSIS
include "./libPopupMenu.php";
$pop = new PopupMenu( "mypopup" );
// add some items
$pop->addItem( "Altavista", "http://www.altavista.com", "_new" );
$pop->addItem( "Go Yahoo!", "http://www.yahoo.com", "_new" );
$pop->addSeparator();
$pop->addItem( "Send me a mail", "mailto:lwest@free.fr?subject=libPopupMenu" );
$pop->addItem( "Page source", "javascript:document.location='view-source:'+document.location" );
// defines some properties
$pop->set( "border", 1 );
$pop->set( "width", 80 );
$pop->set( "margin", 3 );
// output CSS then HTML and JS code
$pop->DisplayCss();
$pop->Display();
// attach the popup to an Anchor
?><a href="#" onMouseOver="<?= $pop->jsCall(); ?>">My Menu</a><?
See Demo
METHODS
PopupMenu( menuid )
Instanciate a new popup. menuid is an identifier for the menu
(in case you have several popup in the page).
addItem( caption, url, [target] )
Add an item to the menu. Javascript calls are possible.
Example: $pop->addItem( "Go Yahoo !", "http://www.yahoo.com/", "_new" );
addSeparator()
Add a line separator
Display()
Outputs the HTML+JS code that "engines" the popup menu.
one call is required.
jsCall()
Returns the javascript code that opens the popup menu.
You have to insert this in an onClick or onMouseOver event handler.
Example:
$call = $pop->jsCall();
<a href="#" onClick="$call">Click me</a>
Set( property, value )
Let you change a menu property.
Example: $pop->Set( "bgcolor", "yellow" );
Supported properties are:
property name | description | default |
width | menu width (pixel) | 100 |
height | menu height (pixel) | 100 |
bgcolor | menu background color | #C0C0C0 |
color | items text color | black |
fontFamily | items font - CSS syntax, multiple values separated by "," | Helvetica, Arial |
fontSize | items font size - CSS syntax | 11px |
align | items text horizontal alignment | left |
margin | margin between border and menu text (pixels) | 2 |
border | border size | 1 |
menuItemFormat | format of a menu item, as used in a printf() call | (*) |
(*) advanced feature. have a look at class code before.
LIMITATIONS
Netscape Browser 4+ compatible *only*
More customizations to come
STATUS
Version 0.4
Licence Free of use
Author Leo West <lwest@free.fr>
Created Sun Oct 01 23:12:04 UTC 2000
Modified Thu Oct 26 11:18:47 UTC 2000
Generated on Thu, 26 04 2000 15:04:38 by RFC Engine Processor - © 1998-2000 Leo West