<script type="text/javascript">
$(document).ready(function () {
$("#a").focus(function () {
$(this).attr("value", "");
$(this).attr("type", "password");
});
});
</script>
<input type="text" name="a" id="a" value="aaa">
$(this).attr("value", "")是执行了没错
但是
$(this).attr("type", "password")被无视了
要么用新的元素取代旧的元素
document.getElementById("a").type="password";