1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <html>
<head>
<script src="http://o.aolcdn.com/dojo/1.5/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript">
//on importe la classe qu l'on va utiliser
dojo.require("dojo.collections.ArrayList");
//on cree un nouveau tableau
var tab = new dojo.collections.ArrayList(["foo","bar","test","bull"]);
//on ajoute quelques éléments
tab.add("foo2");
tab.add("foo3");
//puis un ensemble d'éléments à la fois
tab.addRange(["foo4", "foo5"]);
//finalement on les affiches
var e = tab.getIterator();
while(!e.atEnd()){
var toDisplay = e.get();
alert(toDisplay);
}
</script>
</head>
<body>
</body>
</html> |
Partager