Ajax Layer JavaScript DHTML

http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999


DynAPI Examples - ListBox


  dynapi.library.setPath('./dynapisrc/');
  dynapi.library.include('dynapi.api');
  dynapi.library.include('ListBox');
  dynapi.library.include('ButtonFlatStyle'); // (optional)


dynapi.document.writeStyle({
  firstline:'font-family:arial;font-weight:bold',
  specialline:'color:green;font-family:arial;font-weight:bold'
})
var lb1 = new ListBox(null,100,100,200,200);
// change button up to use flat style
// lb1.vscBar.btnUp.setStyle('ButtonFlat');
lb1.addItem('firstline','First Line',0)
for(var i=1;i<=500;i++){
  if(parseInt(Math.random()*500)==i) lb1.addItem('specialline','Special Item #'+i+'',i);
  else lb1.addItem(null,'List Item #'+i,i);
}
lb1.addItem('specialline','Last Line',0)
lb1.addEventListener({
  onclick:function(e){
    var o=e.getSource();
    //o.removeItem(2)
  }
});
var lb2 = new ListBox(null,350,100,270,150);
lb2.setItemHeight('auto');
lb2.setAltColors('#FFFFAA','#FFCC00');
lb2.addItem(null,'

Main Item #1

');
lb2.addItem(null,'

Main Item #2

');
lb2.addItem(null,'

Next Item #3

');
lb2.addItem(null,'

Main Item #4

');
lb2.addItem(null,'Small Item #5');
lb2.addItem(null,'

This is a test
Message for all to 
see

');
dynapi.document.addChild(lb1);
dynapi.document.addChild(lb2);
var cnt=0;
function showCheck(lst){
  lst.b=!lst.b
  lst.setCheckMode(lst.b)
};
function add(lst){
  var d1=new Date;
  for(var i=0;i<10;i++){
    cnt++
    lst.addItem(null,'Item '+cnt)
  }
  var d2=new Date;
  status=d2-d1
}



Add 10 items to ListBox #2

Show/Hide CheckMode to ListBox #1

Show/Hide CheckMode to ListBox #2




           
         
  
dynapi.zip( 791 k)