Java Reference
In-Depth Information
exercise 2 Question
There is some repetitive code in Example 2. Refactor the code to reduce the duplication.
Additionally, add a function to handle any errors that may occur with the request.
exercise 2 Solution
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chapter 16: Question 2</title>
<style>
.fieldname {
text-align: right;
}
.submit {
text-align: right;
}
</style>
</head>
<body>
<form>
<table>
<tr>
<td class="fieldname">
Username:
</td>
<td>
<input type="text" id="username" />
</td>
<td>
<a id="usernameAvailability" href="#">Check Availability</a>
</td>
</tr>
<tr>
<td class="fieldname">
Email:
</td>
<td>
<input type="text" id="email" />
</td>
<td>
<a id="emailAvailability" href="#">Check Availability</a>
</td>
</tr>
<tr>
<td class="fieldname">
Password:
</td>
<td>
<input type="text" id="password" />
</td>
Search WWH ::




Custom Search