I am VERY new at javascript and I cannot seem to figure out why I keep getting the following error message when I try to run this code:
Error
"document.myform is null or not an object"
I just want to pass the name epoch and the value "date_val" that is returned from the function get_date()
Any help would be greatly appreciated!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Password Changer</title>
</head>
<body>
<FORM NAME="myform">
<p>
<INPUT TYPE="Submit" Action="/cgi-bin/test_pass.cgi" Method="POST" NAME="epoch" VALUE="date_val" onClick="get_date()">
</FORM></p>
<script language="JavaScript">
<!--
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function daysElapsed(date1,date2) {
var difference =
Date.UTC(y2k(date2.getYear()),date2.getMonth(),dat e2.getDate(),0,0,0)
- Date.UTC(y2k(date1.getYear()),date1.getMonth(),dat e1.getDate(),0,0,0);
return difference/1000/60/60/24;
}
function get_date() {
var now = new Date();
var date_val = daysElapsed(new Date(1970,1,1),new Date(now.getYear(), now.getMonth() +1, now.getDate() +1));
document.write(date_val);
document.myform.action='/cgi-bin/test_pass.cgi';
document.myform.submit();
}
//-->
</script>
</body>
</html>