First out:
I'm not sure that document.reservation.email.value will not always work across all browsers. Over the years, I have had my frustrations using that notation.
See: Best Practice: Access form elements by HTML id or name attribute?
The following example worked well for me. Posted a fiddle here:
<form id="reservation">
Valid Email: <input type=text id="validemail" value="abc@def.com">
<label id=Result1>Result is: </label>
<br>
Invalid Email: <input type=text id="invalidemail" value="abc@def.">
<label id=Result2>Result is: </label>
</form>
var emailRE = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
function formChecker(oElement) {
if (!emailRE.test(oElement)) {
window.alert("Your e-mail address is invalid");
return false;
} else {
window.alert("Your e-mail address is valid");
return true;
}
}
document.getElementById("Result1").innerHTML = "Result is: " + formChecker(document.forms["reservation"].validemail.value);
document.getElementById("Result2").innerHTML = "Result is: " + formChecker(document.forms["reservation"].invalidemail.value);
See working example here: http://jsfiddle.net/vNmt4/1/