Well, from another standpoint, that code is needlessly complicated.
Why not simply pass
this into the function doing the check?
Or do it the more modern unobtrusive way, in the first place:
Code:
<!DOCTYPE html>
<html>
<body>
<form id="example"><!-- named forms are obsolete...use id instead -->
<input type="text" size="20" name="email">
<strong>Feedback please:</strong>
<textarea name="S1" rows="2" cols="20"></textarea>
<input type="submit" name="B1" value="Submit">
</form>
<script type="text/javascript">
(
function( )
{
var form = document.getElementById("example");
form.email.onchange =
function( )
{
if ( this.value.indexOf("@") < 0 )
{
alert("invalid email address");
this.focus();
}
}
}
)();
</script>
</body>
</html>