$(function(){
$('.input').bind({
focus:function(){
if (this.value == this.defaultValue){
this.value="";
if($(this).attr('id')=='passwordshow'){$(this).hide(); $("#password").show().focus();}
if($(this).attr('id')=='repasswordshow'){$(this).hide(); $("#repassword").show().focus();}
}
},
blur:function(){
if (this.value == ""){
this.value = this.defaultValue;
}
}
});
})
<input id="passwordshow" type="text" class="input" value="请输入密码"><input name="password" id="password" type="password" class="input" value="" style="display:none">
<input id="repasswordshow" type="text" class="input" value="请输入确认密码"><input name="repassword" id="repassword" type="password" class="input" value="" style="display:none">