All pastes #206864 Raw Edit

Unnamed

public text v1 · immutable
#206864 ·published 2006-10-17 16:48 UTC
rendered paste body
<html>

<head>

<title>Desc 395 Assignment 3</title>

<script language = "JavaScript">

function confirmInfo () {
// if statements are enclosed between 2 parentheses ()
// if you want to see if the value of the field is left blank... hence the ==""
if (document.log_in.StudentName.value == "")  {
	window.alert("You must fill in your full name");
	return false;
}
// it's == not = =
// and also same mistakes for the " "
else if (document.log_in.StudentNumber.value=="")  {
	window.alert("You must fill in your student number");
	return false;

}
// you want to add an else statement if any of the 2 are ok, catches the rest
else {

	window.alert("Your information has been processed");
	return true;
}
}
</head>
</script>
<body>

// makes sure your html tags are as follow name="value" not name = "value"
<form name="log_in" onSubmit="return confirmInfo();">
<p> Student Name:&nbsp; <input type="text" Name="StudentName" size=40></p>
<p> Student Number:&nbsp; <input type="text" Name="StudentNumber" size=40></p>

<p> <input type="submit" value="log in"> <input type="reset" value="reset">
</form>
</body>

</html>