Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'lwest'@'172.20.245.59' (using password: YES) in /mnt/115/sda/7/1/lwest/include/adm/stat.php3 on line 16
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /mnt/115/sda/7/1/lwest/include/adm/stat.php3 on line 18
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