Arne, вот пример
<!DOCTYPE HTML>
<html>
<head> </head>
<body>
<input type="password" id="password-hide">
<input type="text" id="password">
<input type="button" id="show-hide" value="show/hide">
<script>
var bt = document.getElementById("show-hide");
var inp_hide = document.getElementById("password-hide");
var inp = document.getElementById("password");
function show_hide(param) {
var show_state = param.show;
cl();
param.bt.onclick = cl;
function cl (){
if(show_state) show();
else hide();
}
function show() {
param.inp_hide.style.display = "none";
param.inp.value = param.inp_hide.value;
param.inp.style.display = "";
show_state = false;
}
function hide() {
param.inp_hide.style.display = "";
param.inp_hide.value = param.inp.value ;
param.inp.style.display = "none";
show_state = true;
}
}
show_hide({
show: false,
inp_hide: inp_hide,
inp:inp,
bt:bt
});
</script>
</body>
</html>