Java Reference
In-Depth Information
<script>
top.handleResponse('{"available":false, "value":"jmcpeak"}');
</script>
</body>
</html>
The HTML page calls the handleResponse() function in the parent window and passes the JSON
structure signifying that the username or e‐mail address is available. With the response in this
format, you can keep a good portion of the JavaScript code identical to Example 1.
Iframe Smart Form
trY it out
The code for this revised smart form is very similar to the code used previously with the XMLHttpRequest
example. There are, however, a few changes. Open up your text editor and type the following:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chapter 14: Example 2</title>
<style>
.fieldname {
text-align: right;
}
 
.submit {
text-align: right;
}
 
#hiddenFrame {
display: none;
}
</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" />
Search WWH ::




Custom Search