|
TABLE
MAKE
CUSTOMIZE
EFFECTS
EFFECTS CYCLE
EFFECTS CYCLES
VIRTUAL BOX
PLUG-IN
GLIDER
|
Make.Select
Try to create complex Select without writing HTML code: clicking on the buttons, the Selects will be created.
The first is a normal Select, the second is a Select with nested Optgroups and an onChange event, the third is a Select with nested Optgroups and Options. window.addEvent('domready', function() { var items1 = [ 'Blue', 'Red', 'Green', 'Yellow', 'Armonies1', 'Armonies2' ]; var items2 = [ ['Microsoft', 'IE6', 'IE7'], ['Mozilla', 'Firefox', 'Sunbird'], ['Mac', 'Safari'], ['Opera', '9.x', '8.x'] ]; var items3 = [ ['Microsoft', 'IE6', 'IE7'], ['Mozilla', 'Firefox', 'Sunbird'], ['Mac', 'Safari'], ['Opera', '9.x', '8.x'], 'other1', 'other2' ]; var box = $('box'); var box2 = $('box2'); var box3 = $('box3'); var select1 = new Make.Select('select1', items1).make(); var select2 = new Make.Select('select2', items2, {properties: {title:'browsers'}}).make(); var select3 = new Make.Select('select3', items3, {properties: {title:'browsers'}}).make(); $('ok1').addEvent('click', function() { if(!$('select1')) { items1.print_r('box'); box.innerHTML += '<br /><br />'; select1.inject(box); } }); $('ok2').addEvent('click', function() { if(!$('select2')) { items2.print_r('box2'); box2.innerHTML += '<br /><br />'; select2.inject(box2); } }); $('ok3').addEvent('click', function() { if(!$('select3')) { items3.print_r('box3'); box3.innerHTML += '<br /><br />'; select3.inject(box3); } }); select1.addEvent('change', function() { alert('Element changed from the first Select: ' + select1.get('value')); }); select2.addEvent('change', function() { alert('Element changed from the second Select: ' + select2.get('value')); }); select3.addEvent('change', function() { alert('Element changed from the third Select: ' + select3.get('value')); }); }); |