data tables are going to need some work yet, but the other stuff seems to be working 100%
235 lines
6.9 KiB
HTML
235 lines
6.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<title>Menu Buttons</title>
|
|
|
|
<style type="text/css">
|
|
/*margin and padding on body element
|
|
can introduce errors in determining
|
|
element position and are not recommended;
|
|
we turn them off as a foundation for YUI
|
|
CSS treatments. */
|
|
body {
|
|
margin:0;
|
|
padding:0;
|
|
}
|
|
</style>
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
|
<link rel="stylesheet" type="text/css" href="../../build/menu/assets/skins/sam/menu.css" />
|
|
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
|
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
|
<script type="text/javascript" src="../../build/container/container_core-min.js"></script>
|
|
<script type="text/javascript" src="../../build/menu/menu-min.js"></script>
|
|
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
|
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
|
|
|
|
|
<!--begin custom header content for this example-->
|
|
<style type="text/css">
|
|
|
|
/*
|
|
Set the "zoom" property to "normal" since it is set to "1" by the
|
|
".example-container .bd" rule in yui.css and this causes a Menu
|
|
instance's width to expand to 100% of the browser viewport.
|
|
*/
|
|
|
|
div.yuimenu .bd {
|
|
|
|
zoom: normal;
|
|
|
|
}
|
|
|
|
#button-example-form fieldset {
|
|
|
|
border: 2px groove #ccc;
|
|
margin: .5em;
|
|
padding: .5em;
|
|
|
|
}
|
|
|
|
#menubutton3menu,
|
|
#menubutton5menu {
|
|
|
|
position: absolute;
|
|
visibility: hidden;
|
|
border: solid 1px #000;
|
|
padding: .5em;
|
|
background-color: #ccc;
|
|
|
|
}
|
|
|
|
#button-example-form-postdata {
|
|
|
|
border: dashed 1px #666;
|
|
background-color: #ccc;
|
|
padding: 1em;
|
|
|
|
}
|
|
|
|
#button-example-form-postdata h2 {
|
|
|
|
margin: 0 0 .5em 0;
|
|
padding: 0;
|
|
border: none;
|
|
|
|
}
|
|
|
|
</style>
|
|
<!--end custom header content for this example-->
|
|
|
|
</head>
|
|
|
|
<body class=" yui-skin-sam">
|
|
|
|
|
|
<h1>Menu Buttons</h1>
|
|
|
|
<div class="exampleIntro">
|
|
<p>This example demonstrates different ways to create a Menu Button.</p>
|
|
</div>
|
|
|
|
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
|
|
|
<script type="text/javascript">
|
|
|
|
YAHOO.example.init = function () {
|
|
|
|
// "contentready" event handler for the "menubuttonsfrommarkup" <fieldset>
|
|
|
|
YAHOO.util.Event.onContentReady("menubuttonsfrommarkup", function () {
|
|
|
|
// Create a Button using an existing <input> element as a data source
|
|
|
|
var oMenuButton1 = new YAHOO.widget.Button("menubutton1", { type: "menu", menu: "menubutton1select" });
|
|
|
|
var oMenuButton2 = new YAHOO.widget.Button("menubutton2", { type: "menu", menu: "menubutton2select" });
|
|
|
|
|
|
// Create a Button using an existing <input> element and a YAHOO.widget.Overlay instance as its menu
|
|
|
|
var oMenuButton3 = new YAHOO.widget.Button("menubutton3", { type: "menu", menu: "menubutton3menu" });
|
|
|
|
});
|
|
|
|
|
|
// "click" event handler for each item in the Button's menu
|
|
|
|
function onMenuItemClick(p_sType, p_aArgs, p_oItem) {
|
|
|
|
oMenuButton4.set("label", p_oItem.cfg.getProperty("text"));
|
|
|
|
}
|
|
|
|
|
|
// Create a Button without using existing markup
|
|
|
|
// Create an array of YAHOO.widget.MenuItem configuration properties
|
|
|
|
var aMenuButton4Menu = [
|
|
|
|
{ text: "one", value: 1, onclick: { fn: onMenuItemClick } },
|
|
{ text: "two", value: 2, onclick: { fn: onMenuItemClick } },
|
|
{ text: "three", value: 3, onclick: { fn: onMenuItemClick } }
|
|
|
|
];
|
|
|
|
/*
|
|
Instantiate a Menu Button using the array of YAHOO.widget.MenuItem
|
|
configuration properties as the value for the "menu" configuration
|
|
attribute.
|
|
*/
|
|
|
|
var oMenuButton4 = new YAHOO.widget.Button({ type: "menu", label: "one", name: "mymenubutton", menu: aMenuButton4Menu, container: "menubuttonsfromjavascript" });
|
|
|
|
|
|
/*
|
|
Search for an element to place the Menu Button into via the
|
|
Event utilities "onContentReady" method
|
|
*/
|
|
|
|
YAHOO.util.Event.onContentReady("menubuttonsfromjavascript", function () {
|
|
|
|
// Instantiate an Overlay instance
|
|
|
|
var oOverlay = new YAHOO.widget.Overlay("menubutton5menu", { visible: false });
|
|
|
|
oOverlay.setBody("Menu Button 5 Menu");
|
|
|
|
// Instantiate a Menu Button
|
|
|
|
var oMenuButton5 = new YAHOO.widget.Button({ type: "menu", label: "Menu Button 5", menu: oOverlay });
|
|
|
|
/*
|
|
Append the Menu Button and Overlay to the element with the id
|
|
of "menubuttonsfromjavascript"
|
|
*/
|
|
|
|
oMenuButton5.appendTo(this);
|
|
|
|
oOverlay.render(this);
|
|
|
|
});
|
|
|
|
|
|
function onExampleSubmit(p_oEvent) {
|
|
|
|
var bSubmit = window.confirm("Are you sure you want to submit this form?");
|
|
|
|
if(!bSubmit) {
|
|
|
|
YAHOO.util.Event.preventDefault(p_oEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
YAHOO.util.Event.on("button-example-form", "submit", onExampleSubmit);
|
|
|
|
} ();
|
|
|
|
</script>
|
|
|
|
|
|
<form id="button-example-form" name="button-example-form" method="post" action="#">
|
|
|
|
<fieldset id="menubuttons">
|
|
<legend>Menu Buttons</legend>
|
|
|
|
<fieldset id="menubuttonsfrommarkup">
|
|
<legend>From Markup</legend>
|
|
|
|
<input type="submit" id="menubutton1" name="menubutton1_button" value="Menu Button 1">
|
|
<select id="menubutton1select" name="menubutton1select">
|
|
<option value="0">One</option>
|
|
<option value="1">Two</option>
|
|
<option value="2">Three</option>
|
|
</select>
|
|
|
|
|
|
<input type="button" id="menubutton2" name="menubutton2_button" value="Menu Button 2">
|
|
<select id="menubutton2select" name="menubutton2select">
|
|
<option value="0">One</option>
|
|
<option value="1">Two</option>
|
|
<option value="2">Three</option>
|
|
</select>
|
|
|
|
<input type="button" id="menubutton3" name="menubutton3_button" value="Menu Button 3">
|
|
<div id="menubutton3menu" class="yui-overlay">
|
|
<div class="bd">Menu Button 3 Menu</div>
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset id="menubuttonsfromjavascript">
|
|
<legend>From JavaScript</legend>
|
|
</fieldset>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
|
|
|
</body>
|
|
</html>
|