Java Reference
In-Depth Information
<select name=”secondYear” onchange=”recalcDateDiff()“>
<script type=”text/javascript”>
writeOptions(1970, 2020);
</script>
</select>
</p>
<p>
Total difference in days:
<input type=”text” name=”txtDays” value=”0” readonly=”readonly” />
</p>
</form>
</body>
</html>
Call the example ch7_examp9.htm and load it into your web browser. You should see the form shown
in Figure 7-10, but with both date boxes set to the current date.
If you change any of the select boxes, the difference between the days will be recalculated and shown in
the text box.
Figure 7-10
In the body of the page, the form in is built up with six drop-down list boxes and one text box. Let's look
at an example of one of these select elements: Take the fi rst <select/> element, the one that allows the
user to choose the day part of the fi rst date.
<select name=”firstDay” onchange=”recalcDateDiff()“>
<script type=”text/javascript”>
writeOptions(1, 31);
</script>
</select>
Search WWH ::




Custom Search