在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>