当前位置: 代码迷 >> JavaScript >> 把js的变量添加到一个文本框里
  详细解决方案

把js的变量添加到一个文本框里

热度:111   发布时间:2013-01-26 13:47:02.0
求助把js的变量添加到一个文本框里
function comp1(){
  var message = document.getElementById("UserPass").value;
  var message = b64_sha1(message); //进行哈希加密
  var password = document.getElementById(password);
   password = message;
  alert(message);
}


<form action="" method="post">
 <input type="text" id="UserPass" value="" > <input type="text" id="password" value="" ><input name="按钮" type="button"  onclick="comp1()" value="process">
</form>

单击按钮, 将userpass 文本框输入的值通过js加密后 添加到 password的本文框中,谁会呢.

------解决方案--------------------
var password = document.getElementById(password);
   password = message;
你前面都会取值了,怎么赋值反而不会了呢?
document.getElementById('password').value=message;
  相关解决方案