<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"); } });