在html中使用MD5對提交數據進行加密
html代碼如下:
<form id='test_form' action='' method='' omsubmit='return checkForm()'><input type='text' name='username' value=''/>
<input type='password' id='input_pwd' value =''/>
<input type='hidden' name='pwd' id='md5_pwd' value=''/>
<button type='submit'>提交</button>
</form>
<script>
function checkForm(){
var input_pwd= document.getElementById('input_pwd');
var md5_pwd= document.getElementById('md5_pwd');
md5_pwd.value= toMD5(input_pwd.value);
//進行下一步
return ture;
}
</script>