DOJO has hit 1.0 and changed a lot of things. So the documentation is still all over the place with examples using old syntax.
I am migrating to DOJO from jQuery, so just wanted to get basic dojo.query functionality to work. Specifically, I wanted to highlight alternative table rows.
Not easy! At least for a newbie. I had to piece together 3 different documents and examples to figure out the easiest syntax.
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.0.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
dojo.query("table tbody tr:nth-child(odd)").addClass("even");
});
</script>
This highlights 1st, 3rd, 5th… rows in table body. It is also possible to say nth-child(3n+0) to select every third row. However nth-child(3n) does not work, at least in 1.0.




2007/12/08 11:38 ::

comments