, str_repeat(), , , . , , , , , <input type="password" /> (, , ? ?).
, :
<?php
$thePassword = "thisIsMyPassword";
?>
<input type="text" id="input_user_types_in" value="<?php echo str_repeat('*', strlen($thePassword)); ?>" />
<input type="hidden" id="value_to_post_back" name="value_to_post_back" value="<?php echo $thePassword; ?>" />
<script type="text/javascript">
var textInput = document.getElementById('input_user_types_in');
var hiddenInput = document.getElementById('value_to_post_back');
textInput.onfocus = function() {
this.value = hiddenInput.value;
};
textInput.onblur = function() {
var i;
hiddenInput.value = this.value;
this.value = '';
for (i = 0; i < hiddenInput.value.length; i++) {
this.value = this.value + '*';
}
};
</script>
fiddle, -)