A copy of the JavaScript functions in the head element:
// sample-5-form-functions.js
// This sample uses getElementById() to find the result area
// reset validation function
// returns false if the reset element value is an empty string
// otherwise returns true
function validate()
{
var rc = false;
var result_element = document.getElementById("result");
// The value of the result is always set to "" either
// by the body onload call to the loaded() function, or
// by the input onchange call to the changeInput() function
// unless the changeInput has set it to a numeric value.
// check the value attriabute of the result element
if(result_element.value != "")
{
rc = true;
}
return rc;
}
// ----------------------------------------------------------------------------
// the functions loaded() and changeInput() are the same as in previous samples.
// see the previous examples for the code for these two functions.