Template:DoneCounter

From 2009.igem.org

(Difference between revisions)
(Try onLoad)
m (Separate function)
Line 2: Line 2:
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.0/dojo/dojo.xd.js"></script>
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
<script type="text/javascript">
-
dojo.addOnLoad(function(){
+
function showDoneCounts() {
   var doneCounts = dojo.query('.doneCount');
   var doneCounts = dojo.query('.doneCount');
   for(var i=0; i<doneCounts.length; i++) {
   for(var i=0; i<doneCounts.length; i++) {
Line 16: Line 16:
     var numDone = dojo.query('.done',parentElement).length;
     var numDone = dojo.query('.done',parentElement).length;
     doneCount.innerHTML = ' (' + numDone + ' out of ' + (numDone+numTodo) + ' done)';
     doneCount.innerHTML = ' (' + numDone + ' out of ' + (numDone+numTodo) + ' done)';
-
});
+
}
 +
dojo.addOnLoad(showDoneCounts);
</script>
</script>
</html></includeonly><noinclude>This is a script that counts the number of done tasks in a list and puts a string like " (8 out of 9 done)" in fields (spans) with class="doneCount".</noinclude>
</html></includeonly><noinclude>This is a script that counts the number of done tasks in a list and puts a string like " (8 out of 9 done)" in fields (spans) with class="doneCount".</noinclude>

Revision as of 13:58, 14 May 2009

This is a script that counts the number of done tasks in a list and puts a string like " (8 out of 9 done)" in fields (spans) with class="doneCount".