Sunteți pe pagina 1din 1

YUI Library: Button 2011-3-21 v2.

9
Simple Use Cases: YAHOO.widget.Button Key Interesting Moments in Button YAHOO.widget.Button:
See online docs for a complete list of Button's Events. Properties
Create a Button instance using existing markup:
focus blur CSS_CLASS_NAME
Markup: click option NODE_NAME
<input type=button id=mybutton name=mybutton All Button events are Custom Events (see Event Utility docs); subscribe to these events using addListener:
value=Press Me!> (e.g. oButton.addListener(click, fn); ). YAHOO.widget.Button:
Script: Methods
var oButton = new YAHOO.widget.Button("mybutton"); Key Interesting Moments in ButtonGroup
See online docs for a complete list of ButtonGroup's Events. blur()
Create a Button instance using script alone:
Event: Event Fields: destroy()
var oButton =
new YAHOO.widget.Button({ label:"Press Me!}); checkedButtonChange type (s), prevValue (s), newValue (s) focus()
All ButtonGroup events are Custom Events (see Event Utility docs); subscribe to these events using getForm()
addListener (e.g. oButtonGroup.addListener(checkedButtonChange, fn); ). getMenu()
Constructor: YAHOO.widget.Button hasFocus()
YAHOO.widget.Button(str|HTMLElement|obj element[, obj
Key Button Configuration Options isActive()
configuration object]); See online docs for complete list of Buttion configuration options. set([attr name], [attr value])
Option (type) Default Description get([attr name])
Arguments:
type (s) push String specifying the button's type. (Possible
(1) element: HTML ID or HTMLElement of existing markup to values are: "push," "link," "submit," "reset," YAHOO.widget. ButtonGroup:
use when building Button. If neither, this is treated as the "checkbox," "radio," "menu," and "split.") Properties
Configuration object. label (s) null The button's text label or innerHTML.
(2) configuration object: JS object defining configuration CSS_CLASS_NAME
name (s) null The name for the button. NODE_NAME
properties for the Button instance. See Configuration section value (o) null The value for the button.
for full list. checked (b) false Boolean indicating if the button is checked.
(For buttons of type "radio" and "checkbox.") YAHOO.widget. ButtonGroup:
disabled (b) false Boolean indicating if the button should be Methods
Simple Use Cases: YAHOO.widget.ButtonGroup
disabled. (Disabled buttons are dimmed and addButton(button)
Create a ButtonGroup instance using existing markup: will not respond to user input or fire events.) addButtons([]buttons)
href (s) null The href for the button. (For to buttons of type check(index)
Markup:
"link.") destroy()
<div id="mybuttongroup">
<input type="radio" name="myfield" value="One"> menu (o) null Element id, array of YAHOO.widget.MenuItem focus(index)
<input type="radio" name="myfield" value="Two"> configuration attributes, or getButton(index)
<input type="radio" name="myfield" value="Three"> YAHOO.widget.Menu instance. (For buttons of getButtons()
</div> type "menu" and split.) getCount()
Script: menumaxheight (n) 0 The max height height of a Menu before it removeButton(index)
var oButtonGroup = new scrolls. set([attr name], [attr value])
YAHOO.widget.ButtonGroup("mybuttongroup"); menualignment (a) [tl,bl] How the Menu is aligned to the Button. get([attr name])
Button options can be set in the constructor's second argument (eg, {disabled: true}) or at runtime via
set (eg, oButton.set("disabled", true);).
Constructor: YAHOO.widget.ButtonGroup
Dependencies
YAHOO.widget.ButtonGroup(str|HTMLElement|obj Key ButtonGroup Configuration Options
element[, obj configuration object]); See online docs for complete list of ButtonGroup configuration options. Button requires the
Arguments: Option (type) Default Description YAHOO Object,
(1) element: HTML ID or HTMLElement of existing markup to name (s) null The name for the button group (will be applied Event, Dom, and
use when building ButtonGroup. If neither, this is treated as to each button in the button group). Element. Optional:
the Configuration object. disabled (b) false Boolean indicating if the button group should be Container Core and
(2) configuration object: JS object defining configuration disabled. (Disabling the button group will
Menu.
disable each button in the button group.)
properties for the ButtonGroup instance. See Configuration value (o) null Object specifying the value for the button.
section for full list. checkedButton (o) null The checked button in the button group.
ButtonGroup options can be set in the constructor's second argument (eg, {disabled: true}) or at runtime
via set (eg, oButtonGroup.set("disabled", true);).

S-ar putea să vă placă și