一个简单的不能再简单的代码,实现 用户登录。当输入无误的时候点击“提交”后显示用户名和密码;也可以reset,但是目前这两个部分没有实现。用firefox debug说是:document.forms[0].inf is undefined。。求助,大牛给解答一下。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
       <title>Login Page</title>
       <script type="text/JavaScript">
function sc(){
var user=document.forms.user.value;
if(user==""){
    alert("Thr user name can not be blank!!");
return false;
}
var pwd=document.forms.pwd.value;
if(pwd==""){
alert("Passwords can not be blank!!");
return false;
}
var repwd=document.forms.repwd.value;
if(repwd!=pwd){
alert("The second passwords are not same with the first one,please input again!");
document.forms.pwd.value="";
document.forms.repwd.value="";
document.forms.pwd.focus();
return false;
}
var msg=user+repwd;
document.forms[0].inf.value=msg;
alert(msg);
}
function rc(){
document.forms[0].reset();
}
</script>
  </head>
  
  <body>
  <center>
  <form action="" name="forms" method="post">
  <br>Please Input your name:<input name="user" type="text">
  <br>Please Input your password:<input type="text" name="pwd">
  <br>Pleasr Input the paseeword again:<input type="text" name="repwd">
  <br>
  <br>The infomation of the user:
  <input type="text" name="inf" size="30" readonly>
  <br>
  <input type="button" name="sub" value="提交" onclick=javascript:sc()>
  <input type="button" name="ret" value="重置" onclick=javascript:rc()>
  <br>
  </form>
  
   </center>
  </body>
</html>