I am trying to lear javaScript so I am a beginner. Know I am trying to validate empty field, if the user don't enter and email it shows a validation message, if the user don't enter a password it shows a validation message, and the same for both. I tried to do something but it doesn't work. I still don't get that much how the can I call the input fields to java script. If someone can help me


Code:
<html>
<title>  Practice  </title>
<head>
<script> 

 function practice()
{
	if(document.test.firstname.value=="")
	{
		
		alert ("Both field must be field, please provide your email");
		document.test.firstname.focus();
		resturn false;
		
	}
	else (document.test.pwd.value=="")
	{
		alert("Both field must be field, please provide your password"
		document.test.pwd.focus();
		return false;


	}
	else (document.test.firstname.value=="" || document.test.pwd.value=="")
	{
		alert ("Both field must be field");
		document.test.firstname.focus();
		resturn false;
	}
		return(true);
}



</script>
</head>
<body>
<form name="test" onSubmit="practice()">

 First Name: <input type="text" name="firstname"> <br>
 Password: <input type="password" name="pwd" >
	<input type="submit" value="Submit" 
</form>
</body>


</html>