日期:2014-05-16 浏览次数:20505 次
<input name="password" type="text" id="showPwd" tabindex="2" class="input" value="密码" />
$("#showPwd").focus(function(){
$(this).attr('type','password');
});
?
// We can't allow the type property to be changed (since it causes problems in IE)
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
}
?$("#pwd").focus(function(){
$("#pwd")[0].type = 'password';
$("#pwd").val("");
});
?
$("#showPwd").focus(function(){
alert($("#showPwd")[0].type);
$("#showPwd")[0].type = 'password';
$("#showPwd").val("");
});
?
<input name="password" type="password" id="password" class="input" style="display: none;" />
$("#showPwd").focus(function() {
var text_value = $(this).val();
if (text_value == this.defaultValue) {
$("#showPwd").hide();
$("#password").show().focus();
}
});
$("#password").blur(function() {
var text_value = $(this).val();
if (text_value == "") {
$("#showPwd").show();
$("#password").hide();
}
});