方法1: 服務器新增ssl證書,太貴。
方法2:更改數據傳輸類型,對password進行隱藏
html:
<input id="password1" type ="text" AUTOCOMPLETE="off"
onfocus=" if(this.value=='輸入用戶密碼') this.value=''" onblur="if(this.value=='') this.value='輸入用戶密碼'" value="輸入用戶密碼"
onkeypress="javascript:hiddenPass(event)"
onkeyup="this.value=this.value.replace(/./g,'*');" class="password" />
<input id="password" type="hidden" name="password"/>
js:
function hiddenPass(e){
e= e?e:window.event;
var kcode=e.which?e.which:e.keyCode;
var pass=document.getElementById("password1");
var j_pass=document.getElementById("password");
if(kcode!=8 && kcode != 13){
var keychar=String.fromCharCode(kcode);
j_pass.value=j_pass.value+keychar;
j_pass.value=j_pass.value.substring(0,pass.length);
}}
