N
none
Below is an old count-up script that displays ok in MSIE with a bit of
experimenting, but NS shows negative values that make no sense. Anyone
know how to make it work ok in both?
=== Cut ===
<script language=JavaScript>
/*
Date Count-up 1.0
(C) Copyright 1996 Ben Harold
All rights Reserved
Feel free to use this script in your page under the folling
conditions :
1. Do not modify this script in any way (besides
following the
configuration directions) without my consent
2. Mail me at (e-mail address removed) if you use it
3. I am not held responsible for any thing that this
script may
do to your computer
*/
// Configuration Directions
// Don't change this
// This makes a date variable that is used to get the current date
today = new Date()
// Don't change these
// These get the current year, month, and date
var thisyear = today.getYear()
var thismonth = today.getMonth()
var thisdate = today.getDate()
// Change these
// These set the year, month, and date to count from
// NOTICE : var thatmonth should be a number between 0 and 11, not 1
and 12
var thatyear = 1995
var thatmonth = 10
var thatdate = 15
// Change this
// This is what the browser will display just before the years, months,
and dates
// NOTICE : make sure that there is a space after the last word of var
prestring
var prestring = " "
// Don't change these
// These set variables used by other parts of the script
var fromyears = (thisyear - thatyear)
var datenumber = (thisdate + thatdate)
// Don' change this
// This figures out how many days there are in the current month
if (thismonth == 0)
monthdates = (31)
else if (thismonth == 1)
monthdates = (28)
else if (thismonth == 2)
monthdates = (31)
else if (thismonth == 3)
monthdates = (30)
else if (thismonth == 4)
monthdates = (31)
else if (thismonth == 5)
monthdates = (30)
else if (thismonth == 6)
monthdates = (31)
else if (thismonth == 7)
monthdates = (31)
else if (thismonth == 8)
monthdates = (30)
else if (thismonth == 9)
monthdates = (31)
else if (thismonth == 10)
monthdates = (30)
else if (thismonth == 11)
monthdates = (31)
// Don't change this
// This figures out how many years it has been since thatyear
if (fromyears == 0)
yearssince = (prestring)
else if (fromyears == 1)
yearssince = (prestring + " year")
else yearssince = (prestring + fromyears + " years")
// Don't change this
// This figures out how many dates it has been since thatdate
if (thisdate > thatdate)
predatessince = (thisdate - thatdate)
else predatessince = (thisdate + monthdates - thatdate)
if (predatessince == 0)
datessince = ("no days.")
else if (predatessince == 1)
datessince = ("1 day.")
else datessince = (predatessince + " days.")
// Don't change this
// This figures out how many months it has been since thatmonth
if (thisyear > thatyear) {
if (thismonth >= thatmonth)
premonthssince = (thismonth -
thatmonth)
else premonthssince = (12 + thismonth -
thatmonth)
}
else premonthssince = (thismonth - thatmonth)
if (monthdates < datenumber)
premonthssincetwo = (premonthssince + 1)
else premonthssincetwo = (premonthssince)
if (premonthssincetwo == 0)
monthssince = (" ")
else if (premonthssincetwo == 1)
monthssince = ("1 month")
else monthssince = (premonthssincetwo +
"months")
// Don't change these
// These figure out what type of punctuation to use in the final
message
if (yearssince == prestring)
commaone = (" ")
else {
if (monthssince == " ")
(commaone = " and ")
else commaone = (", ")
}
if (commaone == " and ")
commatwo = (" ")
else if (commaone == ", ")
commatwo = (" and ")
else if (yearssince == prestring) {
if (monthssince == " ")
(commatwo = " ")
else commatwo = (" and ")
}
// Don't change this
// This assembles the final message
var finalstring = ""
finalstring += (yearssince)
finalstring += (commaone)
finalstring += (monthssince)
finalstring += (commatwo)
finalstring += (datessince)
// Don't change this
// This prints the final message to the browser screen
document.write(finalstring)
</script>
=== Cut ===
Kari Suomela
KARICO Business Services
Toronto, ON Canada
http://www.karico.ca
.... Never straighten a good waistline.
experimenting, but NS shows negative values that make no sense. Anyone
know how to make it work ok in both?
=== Cut ===
<script language=JavaScript>
/*
Date Count-up 1.0
(C) Copyright 1996 Ben Harold
All rights Reserved
Feel free to use this script in your page under the folling
conditions :
1. Do not modify this script in any way (besides
following the
configuration directions) without my consent
2. Mail me at (e-mail address removed) if you use it
3. I am not held responsible for any thing that this
script may
do to your computer
*/
// Configuration Directions
// Don't change this
// This makes a date variable that is used to get the current date
today = new Date()
// Don't change these
// These get the current year, month, and date
var thisyear = today.getYear()
var thismonth = today.getMonth()
var thisdate = today.getDate()
// Change these
// These set the year, month, and date to count from
// NOTICE : var thatmonth should be a number between 0 and 11, not 1
and 12
var thatyear = 1995
var thatmonth = 10
var thatdate = 15
// Change this
// This is what the browser will display just before the years, months,
and dates
// NOTICE : make sure that there is a space after the last word of var
prestring
var prestring = " "
// Don't change these
// These set variables used by other parts of the script
var fromyears = (thisyear - thatyear)
var datenumber = (thisdate + thatdate)
// Don' change this
// This figures out how many days there are in the current month
if (thismonth == 0)
monthdates = (31)
else if (thismonth == 1)
monthdates = (28)
else if (thismonth == 2)
monthdates = (31)
else if (thismonth == 3)
monthdates = (30)
else if (thismonth == 4)
monthdates = (31)
else if (thismonth == 5)
monthdates = (30)
else if (thismonth == 6)
monthdates = (31)
else if (thismonth == 7)
monthdates = (31)
else if (thismonth == 8)
monthdates = (30)
else if (thismonth == 9)
monthdates = (31)
else if (thismonth == 10)
monthdates = (30)
else if (thismonth == 11)
monthdates = (31)
// Don't change this
// This figures out how many years it has been since thatyear
if (fromyears == 0)
yearssince = (prestring)
else if (fromyears == 1)
yearssince = (prestring + " year")
else yearssince = (prestring + fromyears + " years")
// Don't change this
// This figures out how many dates it has been since thatdate
if (thisdate > thatdate)
predatessince = (thisdate - thatdate)
else predatessince = (thisdate + monthdates - thatdate)
if (predatessince == 0)
datessince = ("no days.")
else if (predatessince == 1)
datessince = ("1 day.")
else datessince = (predatessince + " days.")
// Don't change this
// This figures out how many months it has been since thatmonth
if (thisyear > thatyear) {
if (thismonth >= thatmonth)
premonthssince = (thismonth -
thatmonth)
else premonthssince = (12 + thismonth -
thatmonth)
}
else premonthssince = (thismonth - thatmonth)
if (monthdates < datenumber)
premonthssincetwo = (premonthssince + 1)
else premonthssincetwo = (premonthssince)
if (premonthssincetwo == 0)
monthssince = (" ")
else if (premonthssincetwo == 1)
monthssince = ("1 month")
else monthssince = (premonthssincetwo +
"months")
// Don't change these
// These figure out what type of punctuation to use in the final
message
if (yearssince == prestring)
commaone = (" ")
else {
if (monthssince == " ")
(commaone = " and ")
else commaone = (", ")
}
if (commaone == " and ")
commatwo = (" ")
else if (commaone == ", ")
commatwo = (" and ")
else if (yearssince == prestring) {
if (monthssince == " ")
(commatwo = " ")
else commatwo = (" and ")
}
// Don't change this
// This assembles the final message
var finalstring = ""
finalstring += (yearssince)
finalstring += (commaone)
finalstring += (monthssince)
finalstring += (commatwo)
finalstring += (datessince)
// Don't change this
// This prints the final message to the browser screen
document.write(finalstring)
</script>
=== Cut ===
Kari Suomela
KARICO Business Services
Toronto, ON Canada
http://www.karico.ca
.... Never straighten a good waistline.