
I have a JavaScript day-of-the-week finder at
http://www.koshko.com/calendar/day-of-week-js.html
It works perfectly in Internet Explorer 5 and K-Meleon.
I'm stumped over why it won't work in Netscape Communicator 4.07. The problem seems to be Netscape won't treat the form input as a number instead of a string, so it tries to concatenate the variables for month and date. I've tried some variations and Netscape insists "e is undefined". Other variations come back with NaN. And others determine that every day is Sunday.
Maybe I just need a newer Netscape?
My apologies if this code doesn't post correctly but just in case it's not convenient to view the source, here goes.
function lookup(){
d=parseFloat(document.form1.date.value); // read date from form
m=parseFloat(document.form1.month.value); // read month value from form
y=parseFloat(document.form1.year.value); // read year from form
l=0; // default no leap year
g=(y%100); // last two digits of year
k=g%4; // remainder of last two digits of year divided by four
h=(g-k)/4; // last two digits of year divided by four dropping the fraction
c=((y-g)/100)%4; // remainder of century divided by four
p=y%100; // if year is divisible by 100 answer is 0
q=y%400; // if year is divisible by 400 answer is 0
if (m==0 && k==0) {l=1};
if (m==3 && k==0) {l=1};
if (m==0 && p==0) {l=0};
if (m==3 && p==0) {l=0};
if (m==0 && q==0) {l=1};
if (m==3 && q==0) {l=1};
z = d+m+g+h+6-2*c-l;
b = z%7;
if (b==0) {e="Sunday"};
if (b==1) {e="Monday"};
if (b==2) {e="Tuesday"};
if (b==3) {e="Wednesday"};
if (b==4) {e="Thursday"};
if (b==5) {e="Friday"};
if (b==6) {e="Saturday"};
document.form1.answer.value=e
}
Thanks in advance for all insight.
Rick Koshko