I have a form for users to fill out for my school project. In this form I have a date box so that I know the exact date that someone sent the form. I want Javascript to automatically fill in the box but it says that the its null or not an object. Heres the code:
<script language="Javascript">
<!--
var date=new Date()
var month=date.getMonth()+1
if (month<10) {month="0"+month}
var day=date.getDate()
if (day<10) {day="0"+day}
var year=date.getYear()
if (year<200) year+1900
var dmonth=month
var dday=day
var dyear=year
document.email.date.value=dmonth+"/"+dday+"/"+dyear
-->
</script>
Thats in the head. I then have the form here:
<form name="email" method="post" action="mailto:Zeke@liquid2k.com?subject=HTML Beginners Guide">
Please enter your name:<br>
<input type="text" name="name" size="30"><br><br>
Todays Date:<br>
<input type="text" name="date" size="10"><br><br>
Questions/Comments:<br>
<textarea name="qs_comment" rows=10 cols=120 wrap="virtual">
</textarea><br><br>
Has this site been helpful?<br>
<input type="radio" class="selects" name="helpful_" value="yes" checked> Yes<br>
<input type="radio" class="selects" name="helpful_" value="no"> No<br><br>
How do you like this website?<br>
<input type="radio" class="selects" name="the_site_is_" value="very_nice" checked> Its Very Nice!<br>
<input type="radio" class="selects" name="the_site_is_" value="ok"> Its Ok.<br>
<input type="radio" class="selects" name="the_site_is_" value="bad"> Bad. Needs Improvement.<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset"></form>
I dont understand why it says that document.email.date is null or not an object when it is right there. Any help is appreciated.
Also, can someone tell me the property I add to the form tag to make the text that is emailed to me regular text. I forget what it is.
<script language="Javascript">
<!--
var date=new Date()
var month=date.getMonth()+1
if (month<10) {month="0"+month}
var day=date.getDate()
if (day<10) {day="0"+day}
var year=date.getYear()
if (year<200) year+1900
var dmonth=month
var dday=day
var dyear=year
document.email.date.value=dmonth+"/"+dday+"/"+dyear
-->
</script>
Thats in the head. I then have the form here:
<form name="email" method="post" action="mailto:Zeke@liquid2k.com?subject=HTML Beginners Guide">
Please enter your name:<br>
<input type="text" name="name" size="30"><br><br>
Todays Date:<br>
<input type="text" name="date" size="10"><br><br>
Questions/Comments:<br>
<textarea name="qs_comment" rows=10 cols=120 wrap="virtual">
</textarea><br><br>
Has this site been helpful?<br>
<input type="radio" class="selects" name="helpful_" value="yes" checked> Yes<br>
<input type="radio" class="selects" name="helpful_" value="no"> No<br><br>
How do you like this website?<br>
<input type="radio" class="selects" name="the_site_is_" value="very_nice" checked> Its Very Nice!<br>
<input type="radio" class="selects" name="the_site_is_" value="ok"> Its Ok.<br>
<input type="radio" class="selects" name="the_site_is_" value="bad"> Bad. Needs Improvement.<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset"></form>
I dont understand why it says that document.email.date is null or not an object when it is right there. Any help is appreciated.
Also, can someone tell me the property I add to the form tag to make the text that is emailed to me regular text. I forget what it is.