← 返回 amazon 的题目列表Validate Form and Append to Table
类型:online_judge
Implement a form validation program with three fields: Name, Phone, and Email, each with its own validation criteria. When all fields are valid, append the form information to the bottom of a table; if validation fails, display an error message.
Requirements:
Use Vanilla JavaScript only, no frameworks allowed.
Example: Assume the default table structure is:
<table id="info-table">
<tr>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</tr>
</table>
Sample Input: Assume the input is:
Name: John Doe
Phone: +1-234-567-890
Email: johndoe@example.com
When validation is successful, the table should be updated to:
<table id="info-table">
<tr>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</tr>
<tr>
<td>John Doe</td>
<td>+1-234-567-890</td>
<td>johndoe@example.com</td>
</tr>
</table>
If validation fails, display the appropriate error message.