As Philip kept telling you, you can't use the code
unless you have a <form> with that
name.
You do *NOT* have such. You have a <form> with that ID!
You could fix this part by changing to
Code:
<form name="orders" method="post" action="done.htm">
But form names are considered obsolescent, anyway. So better to leave the <form> tag as you have it and simply change to using
Code:
document.getElementById("orders")
I would suggest this:
Code:
function initForm() {
var form = document.getElementById("orders");
form.date.value = todayTxt();
form.qty1.focus();
form.qty1.select();
}
************
You do have another problem, though. You can't use
method="post" if the
action= of a <form> is another HTML page. You can only use
method="post" when the target action is a server-side page (e.g., a PHP or ASP or JSP or CGI page).
Now, if your <form> will never actually be submitted to the action page (which may well be the case for this page you are working on), then the method won't matter. But as a matter of good practice, if you are going to specify
action="done.htm" then you should also specify
method="get"