Chapter 2 of the BlueJ book. Walk through many of the chapters exercises.

script.js 827B

12345678910111213141516171819202122232425262728293031
  1. function show(type)
  2. {
  3. count = 0;
  4. for (var key in methods) {
  5. var row = document.getElementById(key);
  6. if ((methods[key] & type) != 0) {
  7. row.style.display = '';
  8. row.className = (count++ % 2) ? rowColor : altColor;
  9. }
  10. else
  11. row.style.display = 'none';
  12. }
  13. updateTabs(type);
  14. }
  15. function updateTabs(type)
  16. {
  17. for (var value in tabs) {
  18. var sNode = document.getElementById(tabs[value][0]);
  19. var spanNode = sNode.firstChild;
  20. if (value == type) {
  21. sNode.className = activeTableTab;
  22. spanNode.innerHTML = tabs[value][1];
  23. }
  24. else {
  25. sNode.className = tableTab;
  26. spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
  27. }
  28. }
  29. }