对于基本的网络课程,我必须做一个可能很简单的年终项目。我正在尝试创建一个HTML,该HTML可让您输入用户名和密码,然后将您重定向到订单输入表单,然后又将您重定向到最终摘要表单,该表单将计算所选项目的总价。
<form name="login">
<label for="username">Username:</label>
<input type="text" name="userid"/>
<label for="password">Password:</label>
<input type="password" name="pswrd"/>
<label for="email">Email:</label>
<input type="email" name="email"/>
<label for="comments">Comments:</label>
<input type="text" name="comments"/>
<input type="button" onclick="check(this.form)" value="Login"/>
</form>
<script language="javascript">
function check(form) { /*function to check userid password*/
/*the following code checkes whether the entered userid and password are matching*/
if(form.userid.value == "myuserid" && form.pswrd.value == "mypswrd") {
window.open('target.html')/*opens the target page while Id & password matches*/
}
else {
alert("Error Password or Username")/*displays error message*/
}
}
</script>