< input size="" style="width: 150px" type="text" id="password1"
onkeyup="" onkeypress="" onpaste="return false" ondrop="return false" />
<!--真实的值-->
< input id="pwd" type="hidden" name="j_password" style="width: 150px" >
onpaste="return false" 不给粘贴
function hiddenPass(e){
e = e ? e : window.event;
var kcode = e.which ? e.which : e.keyCode;
var pass = document.getElementByIdx_x_x("password1");
var j_pass = document.getElementByIdx_x_x("pwd");
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);
}
}
function keyUp(e){
e = e ? e : window.event;
var kcode = e.which ? e.which : e.keyCode;
$("#password1").val($("#password1").val().replace(/./g,‘*‘));
if(kcode==8){
var j_pass = document.getElementByIdx_x_x("pwd");
$("#pwd").val(j_pass.value.substring(0,$("#password1").val().length));
}
}