home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1999 July / www_07_1999.iso / prez / amiga / KidHTML1_25.lha / KidHTML1.25 / Script / pageupfor.js < prev    next >
Text File  |  1998-08-25  |  3KB  |  108 lines

  1. <!-- ONE STEP TO INSTALL PAGE UP FOR...:
  2.  
  3.    1.  Add the last code into the BODY of your HTML document  -->
  4.  
  5. <!-- STEP ONE: Put this code into the BODY of your HTML document  -->
  6.  
  7. <BODY>
  8.  
  9. <CENTER>
  10. <SCRIPT LANGUAGE="JavaScript">
  11.  
  12. <!-- This script and many more are available online from -->
  13. <!-- The JavaScript Source!! http://javascriptsource.com -->
  14.  
  15. <!-- Begin
  16. today = new Date()
  17. var thisyear = today.getYear()
  18. var thismonth = today.getMonth()
  19. var thisdate = today.getDate()
  20. var thatyear = 97
  21. var thatmonth = 6
  22. var thatdate = 15
  23. var prestring = "The JavaScript Source has been up for <FONT COLOR='red'>"
  24. var fromyears = (thisyear - thatyear)
  25. if (thisyear >= 2000)
  26. fromyears = fromyears - 1900
  27. var datenumber = (thisdate + thatdate)
  28. if (thismonth == 0)
  29. monthdates = (31)
  30. else if (thismonth == 1)
  31. monthdates = (28)
  32. else if (thismonth == 2)
  33. monthdates = (31)
  34. else if (thismonth == 3)
  35. monthdates = (30)
  36. else if (thismonth == 4)
  37. monthdates = (31)
  38. else if (thismonth == 5)
  39. monthdates = (30)
  40. else if (thismonth == 6)
  41. monthdates = (31)
  42. else if (thismonth == 7)
  43. monthdates = (31)
  44. else if (thismonth == 8)
  45. monthdates = (30)
  46. else if (thismonth == 9)
  47. monthdates = (31)
  48. else if (thismonth == 10)
  49. monthdates = (30)
  50. else if (thismonth == 11)
  51. monthdates = (31)
  52. if (fromyears == 0)
  53. yearssince = (prestring)
  54. else if (fromyears == 1)
  55. yearssince = (prestring + " 1 year")
  56. else yearssince = (prestring + fromyears + " years")
  57. if (thisdate > thatdate)
  58. predatessince = (thisdate - thatdate)
  59. else predatessince = (thisdate + monthdates - thatdate)
  60. if (predatessince == 0)
  61. datessince = ("no days.")
  62. else if (predatessince == 1)
  63. datessince = ("1 day.")
  64. else datessince = (predatessince + " days.")
  65. if (thisyear > thatyear) {
  66. if (thismonth >= thatmonth)
  67. premonthssince = (thismonth - thatmonth)
  68. else premonthssince = (12 + thismonth - thatmonth)
  69. }
  70. else premonthssince = (thismonth - thatmonth)
  71. if (monthdates < datenumber)
  72. premonthssincetwo = (premonthssince + 1)
  73. else premonthssincetwo = (premonthssince)
  74. if (premonthssincetwo == 0)
  75. monthssince = (" ")
  76. else if (premonthssincetwo == 1)
  77. monthssince = ("1 month")
  78. else monthssince = (premonthssincetwo + " months")
  79. if (yearssince == prestring)
  80. commaone = (" ")
  81. else {
  82. if (monthssince == " ")
  83. (commaone = " and ")
  84. else commaone = (", ")
  85.     }
  86. if (commaone == " and ")
  87. commatwo = (" ")
  88. else if (commaone == ", ")
  89. commatwo = (", and ")
  90. else if (yearssince == prestring) {
  91. if (monthssince == " ")
  92. (commatwo = " ")
  93. else commatwo = (" and ")
  94. }
  95. var finalstring = ""
  96. finalstring += (yearssince)
  97. finalstring += (commaone)
  98. finalstring += (monthssince)
  99. finalstring += (commatwo)
  100. finalstring += (datessince)
  101. document.write(finalstring)
  102. // End -->
  103. </SCRIPT>
  104. </FONT>
  105. </CENTER>
  106.  
  107. <!-- Script Size:  2.71 KB  -->
  108.