原因是源于字体,password默认是英文字体,而text默认为定义的字体或者中文字体(我想这是在中文环境下的原因),所以说便出现了长度不一致。解决的方案有二:
1.为input设置font-family英文字体
input {
font-family:'Verdana';
}
2.将text和password的width属性设置为相同的宽度值
<input name="textinput" type="text" size="30" maxlength="12" style="width:200px"> <input name="passwordinput" type="password" size="30" maxlength="12" style="width:200px">