如何在jsp页面中禁用自动完成功能

时间:2014-06-19 08:36:00

标签: javascript html jsp auditing

我有jsp页面它有用户名和密码。如果我们填写用户名和密码并点击提交按钮,然后浏览器询问Remember password然后点击它存储用户名和密码。我不想存储用户名browser.i中的密码和密码使用jsp中的autocomplete=off

<form name="indexFrm" id="indexFrm" autocomplete="off" method="post">

<!DOCTYPE html> 
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Login</title>
<script src="http://code.jquery.com/jquery-1.11.min.js"></script>

<script type="text/javascript">




function login(btnName)
{


  if(window.document.indexFrm.userIdTxt.value=="")
    {
        alert("Enter User Id");
        window.document.indexFrm.userIdTxt.focus();
        return false;
    }
     if(window.document.indexFrm.pwdTxt.value=="")
    {
        alert("Enter Password");
        window.document.indexFrm.pwdTxt.focus();
        return false;
    }else{
   window.document.indexFrm.action = "../epay/abcd.jsp";
   document.indexFrm.method='post';
   window.document.indexFrm.submit();
  }

}



</script>

</head>

<body topmargin="0" leftmargin="0" background="../images/background.gif" onLoad = 'window.document.indexFrm.userIdTxt.focus();'>
<div id="wrapper">
  <form name="indexFrm" id="indexFrm" autocomplete="off" method="post">
<table width="971" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" height="15" style="padding-right:4">
      <div align="right">
        <table border="1" width="10%" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF">
          <tr>
<td width="50%" height="22" bgcolor="#3F9DE5">
                                                <p align="center"><a href="../htmlpages/mainbottom.htm" target="" class="newrightbtn">Home</a> </td>
          </tr>
        </table>
      </div>    </td>
  </tr>
  <tr>
    <td width="100%" height="15"></td>
  </tr>
  <tr>
    <td width="100%">
      <div align="center">
        <center>
        <table border="1" width="60%" bordercolor="#7CC8FA" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%">
              <table width="100%" border="0" cellpadding="0" cellspacing="1" class="newtexts">
                <tr>
                  <td width="100%" bgcolor="#ABDCFC" colspan="2" height="20">
                    <p align="center" class="newhead">LOGIN</td>
                </tr>
                <tr>
                  <td width="100%" bgcolor="#D6EEFE" colspan="2" height="21">&nbsp;</td>
                </tr>
                <tr>
                  <td width="42%" bgcolor="#D6EEFE" align="right">User
                              Id&nbsp; </td>
                  <td width="58%" bgcolor="#D6EEFE"><input type="text" name="userIdTxt" size="20" autocomplete="off"></td>
                </tr>
                <tr>
                  <td width="42%" bgcolor="#D6EEFE" align="right">Password&nbsp;
                              </td>
                  <td width="58%" bgcolor="#D6EEFE"><input type=password name="pwdTxt" id="pwdTxt" size="20" autocomplete="off"></td>
                </tr>

                <td width="100%" colspan="2"><input name="stdSubBtn" type="button" class="newtexts" style="font-family: MS Sans Serif; font-size: 8pt; font-weight: bold"  onClick = 'login(this.name);' ></td>




</table>
<input type="hidden" name="frmName" value="indexFrm">
</form>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

自动填充适用于HTML5.0,我认为您在下面使用它,只需将您的doctype标记更改为

<!DOCTYPE html>

然后试试。