JavaScript libraries exist to perform common operations and to guarantee that code will run on all major browsers.
For example, we can replace the previous showDateAndTime() function with the following:
function showDateAndTime() {
new Ajax.Updater("dateDIV", // DIV to update
"dateAndTime.ajax", // URL
{ method: "get" }); // HTTP method
}
This is a 94% reduction in code.