Image ListBox in JavaScript : Image ListBox « Ajax Layer « JavaScript DHTML

Home
JavaScript DHTML
1.Ajax Layer
2.Data Type
3.Date Time
4.Development
5.Document
6.Dojo toolkit
7.Event
8.Event onMethod
9.Ext JS
10.Form Control
11.GUI Components
12.HTML
13.Javascript Collections
14.Javascript Objects
15.Javascript Properties
16.jQuery
17.Language Basics
18.Mochkit
19.Mootools
20.Node Operation
21.Object Oriented
22.Page Components
23.Rico
24.Scriptaculous
25.Security
26.SmartClient
27.Style Layout
28.Table
29.Utilities
30.Window Browser
31.YUI Library
JavaScript DHTML » Ajax Layer » Image ListBox 




Image ListBox in JavaScript


http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - ListBox</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
  dynapi.library.setPath('./dynapisrc/');
  dynapi.library.include('dynapi.api');
  dynapi.library.include('ListBox');
  dynapi.library.include('ButtonFlatStyle'); // (optional)
</script>
<script language="Javascript">

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)==ilb1.addItem('specialline','<b>Special Item #'+i+'</b>',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,'<h1><img src="./dynapiexamples/images/eicon3.gif">Main Item #1</h1>');
lb2.addItem(null,'<h2><font color="red">Main Item #2</font></h2>');
lb2.addItem(null,'<h3><font color="blue">Next Item #3</font></h3>');
lb2.addItem(null,'<h4>Main Item #4</h4>');
lb2.addItem(null,'Small Item #5');
lb2.addItem(null,'<p><font color="maroon">This is a test<br>Message for all to <br>see</font></p>');

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
}
</script>
</head>
<body>
<a href="javascript:;" onclick="add(lb2)">Add 10 items to ListBox #2</a><br>
<a href="javascript:;" onclick="showCheck(lb1)">Show/Hide CheckMode to ListBox #1</a><br>
<a href="javascript:;" onclick="showCheck(lb2)">Show/Hide CheckMode to ListBox #2</a><br>
<script>
  dynapi.document.insertAllChildren();
</script>
</BODY>
</HTML>

           
       














dynapi.zip( 791 k)
Related examples in the same category
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.