home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 October / tst.iso / tutorials / javascript / DATA / MODULES / NAVIGATE.JS < prev    next >
Encoding:
Text File  |  1998-08-30  |  7.2 KB  |  211 lines

  1. var currentPage = 0;
  2.  
  3. // articles array -- holds the order in which to present the articles
  4.  
  5. var articles = new Array();
  6. articles[0] = "../index/welcome.htm";
  7. articles[1] = "../articles/intro.htm";
  8. articles[2] = "../articles/start.htm";
  9. articles[3] = "../articles/obp.htm";
  10. articles[4] = "../articles/introrev.htm";
  11. articles[5] = "../examples/intro.htm";
  12. articles[6] = "../articles/var.htm";
  13. articles[7] = "../articles/declvar.htm";
  14. articles[8] = "../articles/error.htm";
  15. articles[9] = "../articles/statemnt.htm";
  16. articles[10] = "../articles/varrev.htm";
  17. articles[11] = "../examples/var.htm";
  18. articles[12] = "../articles/operator.htm";
  19. articles[13] = "../articles/unary.htm";
  20. articles[14] = "../articles/compnd.htm";
  21. articles[15] = "../articles/compare.htm";
  22. articles[16] = "../articles/if.htm";
  23. articles[17] = "../articles/preced.htm";
  24. articles[18] = "../articles/oprev.htm";
  25. articles[19] = "../examples/op.htm";
  26. articles[20] = "../articles/loop.htm";
  27. articles[21] = "../articles/while.htm";
  28. articles[22] = "../articles/for.htm";
  29. articles[23] = "../articles/break.htm";
  30. articles[24] = "../articles/arrays.htm";
  31. articles[25] = "../articles/looprev.htm";
  32. articles[26] = "../examples/loop.htm";
  33. articles[27] = "../articles/functs.htm";
  34. articles[28] = "../articles/whatfunc.htm";
  35. articles[29] = "../articles/scope.htm";
  36. articles[30] = "../articles/return.htm";
  37. articles[31] = "../articles/where.htm";
  38. articles[32] = "../articles/layout.htm";
  39. articles[33] = "../articles/funcrev.htm";
  40. articles[34] = "../examples/function.htm";
  41. articles[35] = "../articles/recurs.htm";
  42. articles[36] = "../articles/factorl.htm";
  43. articles[37] = "../articles/io.htm";
  44. articles[38] = "../articles/tdown.htm";
  45. articles[39] = "../articles/recrev.htm";
  46. articles[40] = "../examples/recurs.htm";
  47. articles[41] = "../articles/frames.htm";
  48. articles[42] = "../articles/frmset.htm";
  49. articles[43] = "../articles/noframe.htm";
  50. articles[44] = "../articles/frme.htm";
  51. articles[45] = "../articles/target.htm";
  52. articles[46] = "../articles/morewin.htm";
  53. articles[47] = "../articles/usewin.htm";
  54. articles[48] = "../articles/usename.htm";
  55. articles[49] = "../articles/usefrset.htm";
  56. articles[50] = "../articles/jsproto.htm";
  57. articles[51] = "../articles/framerev.htm";
  58. articles[52] = "../examples/frames.htm";
  59. articles[53] = "../articles/event.htm";
  60. articles[54] = "../articles/evntprog.htm";
  61. articles[55] = "../articles/formobj.htm";
  62. articles[56] = "../articles/crtform.htm";
  63. articles[57] = "../articles/iepain.htm";
  64. articles[58] = "../articles/navobj.htm";
  65. articles[59] = "../articles/eventrev.htm";
  66. articles[60] = "../examples/event.htm";
  67. articles[61] = "../articles/oop.htm";
  68. articles[62] = "../articles/objexamp.htm";
  69. articles[63] = "../articles/argv.htm";
  70. articles[64] = "../articles/addmeth.htm";
  71. articles[65] = "../articles/objprops.htm";
  72. articles[66] = "../articles/useobj.htm";
  73. articles[67] = "../articles/finalobj.htm";
  74. articles[68] = "../articles/objrev.htm";
  75. articles[69] = "../examples/object.htm";
  76. articles[70] = "../articles/cookies.htm";
  77. articles[71] = "../articles/whatckie.htm";
  78. articles[72] = "../articles/useckie.htm";
  79. articles[73] = "../articles/expires.htm";
  80. articles[74] = "../articles/illegal.htm";
  81. articles[75] = "../articles/retrieve.htm";
  82. articles[76] = "../articles/cookrev.htm";
  83. articles[77] = "../examples/cookies.htm";
  84. articles[78] = "../articles/abstract.htm";
  85. articles[79] = "../articles/details.htm";
  86. articles[80] = "../articles/complex.htm";
  87. articles[81] = "../articles/ctrad.htm";
  88. articles[82] = "../articles/src.htm";
  89. articles[83] = "../articles/header.htm";
  90. articles[84] = "../articles/lgproj.htm";
  91. articles[85] = "../articles/result.htm";
  92. articles[86] = "../articles/abstrev.htm";
  93. articles[87] = "../examples/abstract.htm";
  94.  
  95. // viewByReview variable for searching by review articles
  96. var viewByReview = false;
  97.  
  98. // move() function
  99. // if viewByReview is true, skip to previous (or next) review or example (in order)
  100.  
  101. function move(direction) {
  102.    if(viewByReview) {
  103.       if(direction==1) {
  104.          if(currentPage<4)
  105.             currentPage=4;
  106.          else if(currentPage<5)
  107.             currentPage=5;
  108.          else if(currentPage<10)
  109.             currentPage=10;
  110.          else if(currentPage<11)
  111.             currentPage=11;
  112.          else if(currentPage<18)
  113.             currentPage=18;
  114.          else if(currentPage<19)
  115.             currentPage=19;
  116.          else if(currentPage<25)
  117.             currentPage=25;
  118.          else if(currentPage<26)
  119.             currentPage=26;
  120.          else if(currentPage<33)
  121.             currentPage=33;
  122.          else if(currentPage<34)
  123.             currentPage=34;
  124.          else if(currentPage<39)
  125.             currentPage=39;
  126.          else if(currentPage<40)
  127.             currentPage=40;
  128.          else if(currentPage<51)
  129.             currentPage=51;
  130.          else if(currentPage<52)
  131.             currentPage=52;
  132.          else if(currentPage<59)
  133.             currentPage=59;
  134.          else if(currentPage<60)
  135.             currentPage=60;
  136.          else if(currentPage<68)
  137.             currentPage=68;
  138.          else if(currentPage<69)
  139.             currentPage=69;
  140.          else if(currentPage<76)
  141.             currentPage=76;
  142.          else if(currentPage<77)
  143.             currentPage=77;
  144.          else if(currentPage<86)
  145.             currentPage=86;
  146.          else if(currentPage<87)
  147.             currentPage=87;
  148.       }
  149.       else {
  150.          if(currentPage>87)
  151.             currentPage=87;
  152.          else if(currentPage>86)
  153.             currentPage=86;
  154.          else if(currentPage>77)
  155.             currentPage=77;
  156.          else if(currentPage>76)
  157.             currentPage=76;
  158.          else if(currentPage>76)
  159.             currentPage=76;
  160.          else if(currentPage>69)
  161.             currentPage=69;
  162.          else if(currentPage>68)
  163.             currentPage=68;
  164.          else if(currentPage>60)
  165.             currentPage=60;
  166.          else if(currentPage>59)
  167.             currentPage=59;
  168.          else if(currentPage>52)
  169.             currentPage=52;
  170.          else if(currentPage>51)
  171.             currentPage=51;
  172.          else if(currentPage>40)
  173.             currentPage=40;
  174.          else if(currentPage>39)
  175.             currentPage=39;
  176.          else if(currentPage>34)
  177.             currentPage=34;
  178.          else if(currentPage>33)
  179.             currentPage=33;
  180.          else if(currentPage>26)
  181.             currentPage=26;
  182.          else if(currentPage>25)
  183.             currentPage=25;
  184.          else if(currentPage>19)
  185.             currentPage=19;
  186.          else if(currentPage>18)
  187.             currentPage=18;
  188.          else if(currentPage>11)
  189.             currentPage=11;
  190.          else if(currentPage>10)
  191.             currentPage=10;
  192.          else if(currentPage>5)
  193.             currentPage=5;
  194.          else
  195.             currentPage=4;
  196.       }
  197.       this.page.location.href = articles[currentPage]; 
  198.       setCookie("lastPage", currentPage);
  199.    } else {                                              // not viewByReview
  200.  
  201.       currentPage += direction;
  202.  
  203.       if(currentPage == -1)
  204.          currentPage = 0;
  205.       else if(currentPage >= articles.length)
  206.          currentPage = articles.length -1;
  207.  
  208.       this.page.location.href = articles[currentPage];
  209.       setCookie("lastPage", currentPage);
  210.    }
  211. }