同一条数据,在不一样的浏览器上点击编辑,表单中显示的不同,360会把原来记住的帐号密码给显示到上面,谷歌不存在这个问题,一开始考虑让用户都使用谷歌,可是后来发现,这有点不现实,我不可能告诉每一个客户让他使用谷歌浏览器,今天解决了该问题,分享下:浏览器
360显示效果(admin和密码都是以前测试的帐号):测试
谷歌显示效果:this
解决方案:spa
在input标签中添加如下属性:code
“orm
readonly onfocus="this.removeAttribute('readonly')" autocomplete="off" blog
”rem
例如:get
1 <input type="password" readonly onfocus="this.removeAttribute('readonly')" autocomplete="off" class="form-control" placeholder="密码" id="password" name="password">
原理:input
readonly :表明该标签被浏览器解析出来的时候是只读的;
onfocus="this.removeAttribute('readonly')" :在该输入框得到焦点的时候,去掉只读属性;
autocomplete="off" :关闭自动填充的功能,详细介绍见:http://www.w3school.com.cn/tags/att_input_autocomplete.asp