How to compile the message book program? The message book program is not difficult. There are many options to implement it, such as CGI programs. This article describes how to use JavaScript to compile the message book program. The following is a complete example.
---- We provide a form containing the name, the email address of the guest, the browser version used, the country name, comments and suggestions, and the site you like. After entering these fields, press the Submit button and the information will be sent to you by email. The program provides several functions, most of which are used to check the validity of fields. The following is a simple description of the function.
---- The Reset () function resets the content of each field after pressing the Reset button.
---- Function submitForms (): press the submit button to check the validity of the field and then send an email.
---- The isName () function checks the validity of the Name field.
---- Function isEmail () checks the validity of the email address field.
---- The isBrowser () function compares browser fields with the browser version automatically detected.
---- The isCountry () function checks the validity of country fields.
---- The isComment () function checks the validity of opinion fields and does not allow null values.
---- The isFavorite () function checks validity of the site fields that you like. null values are not allowed.
---- The Program also provides some tips, such as how to determine the browser version and string operations.
---- The result is provided to you via email, which contains fields entered by the guests. The program is long, but it is not difficult to understand. The following is the source code: