/**
* input提示框
* 链式编程,jquery对象调用方法返回jquery对象
* <input type="text" inputTip="请输入用户名/邮箱" name="username" id="username" class="inputBlur">
* .inputFocus{
color : #C0C0C0;
}
.inputBlur{
color : black;
}
*/
$(function(){
$("#username").focus(function(){
if($(this).val()==$(this).attr("inputTip")){
$(this).val("");
}
$(this).addClass("inputFocus");
}).blur(function(){
if($.trim($(this).val()).length == 0){
$(this).val($(this).attr("inputTip"));
$(this).removeClass("inputFocus");
}
}).blur();
});