buttons.html revision 4679bde12548e75a51abcb9c51cde874e70427a8
<!DOCTYPE html>
<html>
<head>
<style>
body .yui3-button-selected {
background-color:#426FD9;
color:white;
}
</style>
<script src='/build/yui/yui-min.js'></script>
<script>
YUI({
debug: true,
combo: false,
filter: 'raw'
}).use('button', 'console', function(Y){
new Y.Console().render();
var groupA = new Y.ButtonGroup({
srcNodes: Y.all('.radioGroupA'),
type: 'radio'
});
var groupB = new Y.ButtonGroup({
srcNodes: Y.all('.radioGroupB'),
type: 'radio'
});
var groupC = new Y.ButtonGroup({
type: 'checkbox'
});
Y.all('.cbGroup').each(function(node){
groupC.addButton(new Y.Button({
srcNode: node
}));
});
groupA.on('selectionChange', function(){
Y.log('groupA - Currently selected: ' + this.getSelectedValues());
//console.log(groupB.getBar());
});
groupB.on('selectionChange', function(){
Y.log('groupB - Currently selected: ' + groupB.getSelectedValues());
//console.log(groupB.getBar());
});
groupC.on('selectionChange', function(){
Y.log('groupC - Currently selected: ' + groupC.getSelectedValues());
});
});
</script>
</head>
<body class='yui3-skin-sam'>
<div id='yconsole'></div>
<h1>Button Example: Groups</h1>
<hr />
<h2>Radio A</h2>
<input type='button' class='radioGroupA' value='1'>
<input type='button' class='radioGroupA' value='2'>
<input type='button' class='radioGroupA' value='3'>
<input type='button' class='radioGroupA' value='4'>
<input type='button' class='radioGroupA' value='5'>
<input type='button' class='radioGroupA' value='6'>
<h2>Radio B</h2>
<input type='button' class='radioGroupB' value='1'>
<input type='button' class='radioGroupB' value='2'>
<input type='button' class='radioGroupB' value='3'>
<input type='button' class='radioGroupB' value='4'>
<input type='button' class='radioGroupB' value='5'>
<input type='button' class='radioGroupB' value='6'>
<h2>Checkbox</h2>
<input type='button' class='cbGroup' value='a'>
<input type='button' class='cbGroup' value='b'>
<input type='button' class='cbGroup' value='c'>
<input type='button' class='cbGroup' value='d'>
<input type='button' class='cbGroup' value='e'>
<input type='button' class='cbGroup' value='f'>
</body>
</html>