<input type="text" id="txtUserName" name="UserName" maxlength="50" value="请输入用户名" style="color: #999999" />
<input type="text" id="showPwd" class="inputone" maxlength="50" name="Password" value="请输入基础库平台密码" style="color: #999999" /> <input type="password" id="txtPassword" class="inputone" maxlength="50" name="Password" style="display: none;" />
$("#txtUserName").focus(function () { var name = $(this).val(); if (name == "请输入用户名") { $(this).val(""); $(this).css("color", "#000"); } }).blur(function () { var name = $(this).val(); if (name == "") { $(this).val("请输入用户名"); $(this).css("color", "#999"); } }); $("#showPwd").focus(function () { var text_value = $(this).val(); if (text_value == this.defaultValue) { $("#showPwd").hide(); $("#txtPassword").show().focus(); } }); $("#txtPassword").blur(function () { var text_value = $(this).val(); if (text_value == "") { $("#showPwd").show(); $("#txtPassword").hide(); $(this).css("color", "#000"); } });