HTML and CSS Reference
In-Depth Information
FiGure 21-3
On the CSS side, I removed the border with one simple rule:
input {
border: none;
This technique allows the JavaScript to dynamically insert the date and very cleanly integrate it into
the page.
Triggering Javascript interactively
As the name implies, the onload event handler calls the specified function (or functions) when the
content in the <body> tag has finished loading.
Other event handlers exist besides onload . These additional event handlers make it possible for
JavaScript functions to be interactively called and depend on user action. The primary event
handlers include:
JavaScript event handlers are most frequently applied to links, form controls, and form buttons.
For example, suppose you want to create another JavaScript function that returns the current time
and allows the user to get that value whenever a form button is clicked. Here's the JavaScript func-
tion, which as you can see, introduces another JavaScript concept, the if-then-else or conditional
<script type=”text/javascript”>
function getCurrentTime() {
var theAM_PM;
var theDate = new Date();
var theHour = theDate.getHours();
if (theHour < 12) {
Search WWH ::

Custom Search