How It Works
The opening page displays a button and an empty DIV:
<input type="button"
value="Show Date and Time"
onclick="showDateAndTime();"
class="button"/>
<div id="dateDIV" class="dateDiv"/>
Note:
- The div element is HTML's
generic block-level container
- The button is an HTML button whose type is button and
not submit
- On clicking, the surrounding form is not submitted; instead the
JavaScript showDateAndTime() function is called
- It generates a request to run a Servlet on the server that
will write to a response
- That response will have the date and time
- When the response is complete, the JavaScript will take the
response and place it in the page by using the
innerHTML property of the DOM for the div element