Java Reference
In-Depth Information
alert(“We're sorry, but “ + userValue + “ is not available.”);
}
}
The function fi rst checks to see if the user name is available. If so, an alert box tells the user that the
user name is available. If not, the user sees an alert box stating that the user name is not available.
The functions for searching e-mail addresses follow the same pattern as those for searching user
names.
function checkEmail()
{
var emailValue = document.getElementById(“email”).value;
if (emailValue == “”)
{
alert(“Please enter an email address to check!”);
return;
}
var url = “iframe_formvalidator.php?email=” + emailValue;
frames[“hiddenFrame”].location = url;
}
function checkEmail_callBack(data, emailValue)
{
if (data == “available”)
{
alert(“The email “ + emailValue + “ is currently not in use!”);
}
else
{
alert(“We're sorry, but “ + emailValue + “ is in use by another user.”);
}
}
The checkEmail() function retrieves the text box's value, checks to see if the user entered data, con-
structs the URL, and loads the URL into the iframe.
The checkEmail_callBack() function contains changes similar to those made to checkUsername_
callBack(). The function now accepts two arguments, checks to see if the e-mail is available, and dis-
plays a message accordingly.
Dealing with Delays
The web browser is just like any other conventional application in that user interface (UI) cues tell the
user that something is going on. When a user clicks a link, the throbber animation runs, an hourglass
appears next to the cursor (in Windows), and a status bar usually shows the browser's progress in load-
ing the page.
Search WWH ::




Custom Search