文本框默認提示信息,以及密碼默認提示

 <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="displaynone;" />

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章